piotr-cz / xmpp-prebind-php
dev-master
2015-02-26 17:32 UTC
Requires
- php: >=5.3
- lib-libxml: *
This package is not auto-updated.
Last update: 2022-02-01 12:40:47 UTC
README
此类用于使用PHP进行预先绑定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,因此你首先需要安装它。
其他语言
存在其他项目支持其他语言进行预先绑定。去谷歌搜索一下吧 :)
注意事项
此类并不完全具有所有功能。也可能存在错误。如果你能贡献或者提交错误报告,我会非常感激。
谢谢。