openfire获取在线用户
我使用 OpenFire 服务器进行即时消息传递,并在客户端使用 JSJaC JavaScript 库。我是 XMPP 技术的新手。
我想要的是加载时我想发送用户列表并接收每个用户的状态。类似这样
$(function(){
var UserList = ["Isis", "Jackob", "Oybek"];
con.send(UserList, OnComplete);
});
function OnComplete(myList){
for (el in myList)
if (el.IsOnline) {
// Do DOM Stuff
}
}
可能吗?
我一直在寻找文档、示例和其他类似的回复,但没有找到任何内容。
I'm using OpenFire server for instant messaging and JSJaC JavaScript library on the client. I'm new in XMPP technology.
What I want is on load I want to send a list of users and receive status for each. Something like
$(function(){
var UserList = ["Isis", "Jackob", "Oybek"];
con.send(UserList, OnComplete);
});
function OnComplete(myList){
for (el in myList)
if (el.IsOnline) {
// Do DOM Stuff
}
}
Is it possible?
I've been looking for the documentation, examples and other similar responses but didn't find anyting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法查询是否存在。您可以订阅状态。如果您发送自己的状态信息,服务器将向您发送您订阅的每个人的当前状态信息,以及从那时起他们对其状态状态所做的每项更改。无法判断您何时“完成”获得存在,因为你永远不会完成。只需设置一个回调,以便在您订阅的人的状态发生变化时执行一些有趣的操作,这样您就会处于良好状态:
You can't query for presence. You can subscribe to presence. If you send your own presence in, the server will send you the current presence of everyone you have subscribed to, as well as every change they make to their presence from there on in. There's no way to tell when you're "done" getting presence, because you're never done. Just set up a callback to do something interesting whenever you get a presence change from the person you are subscribed to, and you'll be in good shape: