dusta / xmpp-prebind-php
此类用于使用PHP预先绑定XMPP会话。
dev-master
2018-03-27 09:19 UTC
Requires
- php: >=5.6
- lib-libxml: *
This package is auto-updated.
Last update: 2024-09-09 22:05:51 UTC
README
此类用于预先绑定XMPP会话。
用法
- 克隆仓库
- 在你想进行预先绑定的文件中
/** * Comment here for explanation of the options. * * Create a new XMPP Object with the required params * * @param string $jabberHost Jabber Server Host * @param string $boshUri Full URI to the http-bind * @param string $resource Resource identifier * @param bool $useSsl Use SSL (not working yet, TODO) * @param bool $debug Enable debug */ $xmppPrebind = new XmppPrebind('your-jabber-host.tld', 'http://your-jabber-host/http-bind/', 'Your XMPP Clients resource name', false, false); $xmppPrebind->connect($username, $password); $xmppPrebind->auth(); $sessionInfo = $xmppPrebind->getSessionInfo(); // array containing sid, rid and jid
- 如果你使用Candy,将
Candy.Core.Connect()
行更改为以下内容
Candy.Core.attach('<?php echo $sessionInfo['jid'] ?>', '<?php echo $sessionInfo['sid'] ?>', '<?php echo $sessionInfo['rid'] ?>');
- 现在你应该有一个使用PHP工作的预先绑定
调试
如果出现问题,你可以启用调试。调试输出记录到FirePHP,所以你首先需要安装它。
其他语言
存在其他项目用于支持其他语言的预先绑定。去谷歌搜索吧 :)
请注意
此类功能并不完整。也可能存在错误。如果您能贡献或提交错误报告,我将不胜感激。
谢谢。