XMPPHP sends message but won't receive
<?php
include("XMPP.php");
$conn = new XMPPHP_XMPP('server.com', 5222, 'user', 'pass', 'home');
$conn->useEncryption(true);
$conn->connect();
$conn->processUntil('session_start');
$conn->message('person@server.com', mktime());
$payloads = $conn->processUntil('message');
$conn->message('person@server.com', mktime());
$conn->disconnect();
?>
Right... so it connects - it starts the session and sends the first timestamp which is received on the jabber client I'm using.
Then its supposed to "processUntil" a message is received (afaik) and if a message is received send another timestamp. Well, this bit is the bit that doesn't work.
I have no prior knowledge of XMPP servers or XMPPHP, so开发者_JAVA百科 all help, however basic, wouldn't go unappreciated! :)
Thanks.
I fought with this for a while. Turns out that you have to announce your presence when you connect. I extracted this from the cli_longrun_example.php and put it after my $conn->connect() and $conn->processUntil('session_start') calls:
$conn->presence($status='Controller available.');
you can recive first message in your jabber client. with
$conn->message('person@server.com', mktime());
but then you are recive message from server with
$payloads = $conn->processUntil('message');
but you cant recive message with that.
and scrpit cant load haead so you cant receive another message. i have a same problem. you can use jaxl for that.
精彩评论