Java 如何从strophe连接中提取rid和sid的值

Java 如何从strophe连接中提取rid和sid的值,java,xmpp,strophe,converse.js,Java,Xmpp,Strophe,Converse.js,我试图从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:x

我试图从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 expose_rid_和_sid

converse.initialize({
     prebind: false,
     bosh_service_url: BOSH_SERVICE,
     show_controlbox_by_default: true,
     expose_rid_and_sid: true
});
在那之后,你就不能摆脱和希德的关系了

converse.getSID();
converse.getRID();
或者,如果您有更新的版本,您可以使用

converse.tokens.get('sid');
converse.tokens.get('rid');

初始会话创建应返回SID。您最初是如何连接的?感谢您的回复标记…在使用连接后,我终于让它工作了。\u proto.rid