如何在xmpphp中接收消息



示例中清楚地说明了如何发送消息,但我不清楚如何接收服务器中其他客户端发起的消息。非常感谢任何帮助

这是我发送信息的代码

include("xmpphp/xmpp.php");
//username = user without domain, "user" and not "user@server" - home is the resource
$conn = new XMPPHP_XMPP('localhost', 5222, 'robel27', 'yoyene122127', 'kiyos');
// Enables TLS - enabled by default, call before connect()!
$conn->useEncryption(false);
$conn->connect();
 // shows the user's status message
$conn->presence();
$conn->processUntil(array('session_start', 'roster_received'));
$conn->processTime(2);
$conn->message('kiyos12@kiyos', $_POST['msg1']);
$conn->disconnect();

要获取消息,可以使用$data = $conn->processUntil('message');

最新更新