你會發現你需要通過這個鏈接是什麼: Java - trying to prebind converse.js using bosh but not able to get the sid and rid...using the smack bosh
其他方式,如果你可以使用JavaScript來獲得JID,SID和趕走,你可以在下面參考: 您可以使用strophe.js
創建波什首先綁定,然後從連接中獲取它們。
//I user local openfire here
var BOSH_SERVICE = 'http://127.0.0.1:7070/http-bind/';
var connection = null;
//you can get your usr and pwd in other way
var jid = '[email protected]';
var password = 'admin';
connection = new Strophe.Connection(BOSH_SERVICE);
connection.connect(jid,
password,
onConnect);
,然後從onConnect()
功能得到細節是這樣的:
function onConnect(status)
{
if (status == Strophe.Status.CONNECTED) {
//then you can get what you want
console.log("---SID[" + connection._proto.sid + "] RID[" + connection._proto.rid + "] JID[" + jid + "]");
}
}
好運!
哦......我沒有注意到你正在使用smack庫... –