您好 XMPP/JAXL 专家,我正在尝试在以下环境中使用 JAXL 设置预绑定:
- CentOS 6.x - PHP 5.3.3
- Openfire 4.0.3(已激活 BOSH 服务器)
- 贾克斯 3.0.1
- 匡威.js
没有 prebindind(也没有 jaxl)一切似乎都运行顺利,但由于某种原因,我无法让 jaxl 工作。当我尝试启动 echo_bosh_bot 时,出现以下错误:
[root@dev examples]# php echo_bosh_bot.php chat@localhost chat
jaxl:160 - 2016-10-27 09:43:32 - strict mode enabled, adding exception handlers. ' .
'Set 'strict' => false inside JAXL config to disable this
jaxl:203 - 2016-10-27 09:43:33 - created pid file /software/JAXL-master/examples/.jaxl/run/jaxl_6116.pid
jaxl_exception:48 - 2016-10-27 09:43:33 - got jaxl exception construct with Argument 1 passed to JAXL::require_xep() must be an array, string given, called in /software/JAXL-master/src/JAXL/jaxl.php on line 228 and defined, 4096, /software/JAXL-master/src/JAXL/jaxl.php, 282
jaxl:250 - 2016-10-27 09:43:33 - cleaning up pid and unix sock files
[root@dev examples]# ^C
[root@dev examples]#
显然,预招标也没有很好地运作;当我运行 prebind.php 时,我得到了 200 OK,但是在我得到的响应中
syntax error: JSON.parse: Unexpected end of data at line 1 column 1 of the json data
这是我的 prebind.php 文件:
<?php
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json; charset=utf-8');
date_default_timezone_set('Europe/Rome');
require '/software/JAXL-master/vendor/autoload.php';
require '/software/JAXL-master/src/JAXL/jaxl.php';
$client = new JAXL(array(
'jid'=>'chat@localhost',
'pass'=>'chat',
'bosh_url' => 'http://localhost/http-bind'
));
$client ->add_cb('on_auth_success', function(){
global $client;
$array = array(
//'rid' => $client->xeps['0206']->rid,
//'sid' => (string)$client->xeps['0206']->sid,
'jid'=> $client->jid->to_string(),
'bosh_url' => 'http://localhost/http-bind'
);
echo json_encode($array);
exit;
});
$client->add_cb('on_auth_failure', function($reason) {
global $client;
echo("got on_auth_failure cb with reason $reason");
$client->send_end_stream();
});
$client->start();
echo "done";
?>
任何帮助将不胜感激 - 谢谢
朱利奥