XMPP:检索 BOSH 会话 ID 和 RID [英] XMPP: retrieving BOSH Session ID and RID

查看:28
本文介绍了XMPP:检索 BOSH 会话 ID 和 RID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何检索 SID 和 JID.我正在使用 Strophe JS.

Please tell me how to retrieve the SID and JID. I am using Strophe JS.

<body rid='489923353' xmlns='http://jabber.org/protocol/httpbind' sid='ab7f5957' to='127.0.0.1' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>

var conn = new Strophe.Connection(bosh_service); 

但是,conn.sidconn.rid 不会返回相同的数字.

However, conn.sid or conn.rid is not returning the same numbers.

推荐答案

经过这个和那个,我想我找到了答案!

After this and that, I think I found the answer!

else if(status === Strophe.Status.CONNECTED){

        //get roster
        var iq = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:roster'});
        Chat.connection.sendIQ(iq, Chat.on_roster);  
        //on chat
        Chat.connection.addHandler(Chat.on_message,null, "message", "chat");

        $("#presence").html("Connection SID" + Chat.connection.sid + "Connection RID" +  Chat.connection.rid);
    }

这篇关于XMPP:检索 BOSH 会话 ID 和 RID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆