XMPP: retrieving BOSH Session ID and RID

烂漫一生 提交于 2019-12-05 18:27:26

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);
    }
  1. For SID use Chat.connection._proto.sid instaed of Chat.connection.sid.
  2. For RID use Chat.connection._proto.rid instaed of Chat.connection.rid
  3. For JID use Chat.connection.jid .

Here SID and RID are properties of BOSH object where as JID is the property of Strophie object. It is working for me fine. I hope it will work for you also.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!