[英]How do we extract the values of rid and sid from the strophe connection
我正在嘗試從 strophe 連接中獲取 SID、RID 和 JID 的值,並嘗試將它們傳遞給 converse.js。 我正在運行 strophe 附帶的示例,我能夠獲取包含所有值的消息,但無法從元素中檢索值。
<body rid='629033749' xmlns='http://jabber.org/protocol/httpbind' sid='c270b6b5' to='127.0.0.1' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>
我試過 connection.sid 但返回未定義。 有人可以幫我解決這個問題嗎?
只是為了記錄,converse.js 的另一種方法是在初始化 converse.js 時設置為 true 暴露_rid_and_sid
converse.initialize({
prebind: false,
bosh_service_url: BOSH_SERVICE,
show_controlbox_by_default: true,
expose_rid_and_sid: true
});
之后你不能得到 RID 和 SID
converse.getSID();
converse.getRID();
或者,如果您有更新的版本,則可以使用
converse.tokens.get('sid');
converse.tokens.get('rid');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.