Php 使用strophe获取在线用户列表xmpp
我使用strophe Library成功连接到openfire服务器 我想要一个javascript函数,它返回会议室中的所有用户 另一个问题是:如何设置/获取当前用户的状态 我当前的代码:Php 使用strophe获取在线用户列表xmpp,php,xmpp,strophe,Php,Xmpp,Strophe,我使用strophe Library成功连接到openfire服务器 我想要一个javascript函数,它返回会议室中的所有用户 另一个问题是:如何设置/获取当前用户的状态 我当前的代码: $(document).ready(function() { connection = new Strophe.Connection(BOSH_SERVICE); connection.connect("null", "null", onCon
$(document).ready(function() {
connection = new Strophe.Connection(BOSH_SERVICE);
connection.connect("null",
"null",
onConnect);
});
function onConnect(status)
{
if (status == Strophe.Status.CONNECTED) {
$('#notifications').html('<p class="welcome">Hello! Any new posts will appear below.</p>');
connection.addHandler(notifyUser, null, 'message', null, null, null);
console.log('send ');
var pres = $pres({to: 'chat@conference.neo-pc/catalin'});
connection.send(pres);
}
}
$(文档).ready(函数(){
连接=新的选通连接(BOSH_服务);
connection.connect(“null”,
“空”,
连接);
});
连接功能(状态)
{
如果(状态==Strophe.status.CONNECTED){
$('#notifications').html('您好!任何新帖子都将出现在下面。
');
addHandler(notifyUser,null,'message',null,null,null);
console.log('send');
var pres=$pres({to:'chat@conference.neo-pc/catalin'});
连接发送(pres);
}
}
发送初始状态后,您将获得一份名册
-如何在登录后检索花名册
要获得某人的存在,你需要发送一个存在IQ。然后获取status元素
如果您想查看我使用strophe.js构建的xmppp客户端,请访问:谢谢,我需要的正是它。顺便说一句,我试图登录hularing,但我说连接到服务器失败。我需要一个特殊的id/密码吗?