matteocacciola / xmpp-prebind-php
此类用于使用 PHP 预绑定 XMPP 会话。
dev-master
2018-05-14 16:32 UTC
Requires
- php: >=5.3
- lib-libxml: *
This package is auto-updated.
Last update: 2024-09-25 07:53:39 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 * @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,因此你首先需要安装它。
其他语言
存在支持预绑定的其他语言项目。去 Google 搜索吧 :)
SSL
实际上,如果 useSSL 为 false,只需设置 CURLOPT_SSL_VERIFYPEER 和 CURLOPT_SSL_VERIFYHOST
请注意
此类尚未完全实现功能。也可能存在错误。如果您能贡献或提交错误报告,我将不胜感激。
谢谢。