JAXL issue with Openfire

135 views Asked by At

Hello XMPP/JAXL experts, I'm trying to set up prebind with JAXL in the following environment:

  • CentOS 6.x - PHP 5.3.3
  • Openfire 4.0.3 (BOSH server activated)
  • Jaxl 3.0.1
  • Converse.js

Without prebindind (and without jaxl) everything seems to run smoothly, but for some reason I cannot manage to make jaxl work. when I try to launch echo_bosh_bot, I get the following error:

[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]#

Obviously also the prebiding is not working well; when I run prebind.php I got 200 OK, but in the response i got

syntax error: JSON.parse: Unexpected end of data at line 1 column 1 of the json data

This is my prebind.php file:

<?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";

?>

Any help would be really appreciated - thank you

Giulio

0

There are 0 answers