How can I get the SID & RID when connecting to a XMPP server using strophejs ? I am using Ejabbered as the XMPP server.
Here is my code
$
I get the RID and SID from my strophe connection by adding a function to connection.xmlOutput. This gives the ability to view the outgoing stanza's before they're sent. Here is an example:
connection.xmlOutput = function (e) {
if (IS_CONNECTED) {
LAST_USED_RID = $(e).attr('rid');
LAST_USED_SID = $(e).attr('sid');
log(' XMLOUTPUT INFO - OUTGOING RID=' + LAST_USED_RID + ' [SID=' + LAST_USED_SID + ']');
//log(' XMLOUTPUT INFO - OUTGOING XML = \n'+e.outerHTML);
//set some variables to keep track of our rid and sid
}
};
You may also be able to access the RID and SID properties from connection's ._proto
, ex:
connection._proto.rid
This may be related: https://github.com/jcbrand/converse.js/issues/180