【问题标题】:Get online users list xmpp with strophe [closed]使用 strophe 获取在线用户列表 xmpp [关闭]
【发布时间】:2013-03-19 12:28:40
【问题描述】:

我使用 strophe 库成功连接到 openfire 服务器。

我想要一个从会议室返回所有用户的 javascript 函数。

另一个问题是:如何设置/获取当前用户的状态?

我当前的代码:

$(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);


    }
}

【问题讨论】:

    标签: php xmpp strophe


    【解决方案1】:

    在您发送初始状态后,您将获得一份名册。

    http://xmpp.org/rfcs/rfc6121.html#roster-login - 登录后如何找回名册。

    要获得某人的出席信息,您需要发送出席信息 IQ。然后获取状态元素。

    如果您想查看我使用 strophe.js 构建的 xmppp 客户端,请访问:http://hularing.me/

    【讨论】:

    • 谢谢,正是我需要的。顺便说一句,我尝试登录 hularing,但我说连接到服务器失败。我需要一个特殊的 ID/密码吗?
    猜你喜欢
    • 1970-01-01
    • 2013-01-04
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 2014-11-06
    相关资源
    最近更新 更多