Does not disconnect from the XMPP server on unload in jitsi-meet-new because the API has taken on that responsibility.
This commit is contained in:
parent
2ccfc30813
commit
feb0abf701
|
@ -78,19 +78,6 @@ function sendEmail (email) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Leave the conference and close connection.
|
|
||||||
*/
|
|
||||||
function unload (ev) {
|
|
||||||
// XXX On beforeunload and unload, there is precious little time to send
|
|
||||||
// requests. Since we are really interested in letting the XMPP server know
|
|
||||||
// that the local peer is going away (so that the XMPP server may notify the
|
|
||||||
// remote peers) and disconnecting should achieve that, do not bother with
|
|
||||||
// leaving the room.
|
|
||||||
//room.leave();
|
|
||||||
connection.disconnect(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user nickname by user id.
|
* Get user nickname by user id.
|
||||||
* @param {string} id user id
|
* @param {string} id user id
|
||||||
|
@ -247,8 +234,8 @@ export default {
|
||||||
localTracks = tracks;
|
localTracks = tracks;
|
||||||
connection = con;
|
connection = con;
|
||||||
this._createRoom();
|
this._createRoom();
|
||||||
$(window).bind('beforeunload', unload );
|
// XXX The API will take care of disconnecting from the XMPP server
|
||||||
$(window).bind('unload', unload );
|
// (and, thus, leaving the room) on unload.
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
(new ConferenceConnector(resolve, reject)).connect();
|
(new ConferenceConnector(resolve, reject)).connect();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13158,7 +13158,7 @@ module.exports = function () {
|
||||||
}).call(this,"/modules/xmpp/strophe.util.js")
|
}).call(this,"/modules/xmpp/strophe.util.js")
|
||||||
},{"jitsi-meet-logger":79}],44:[function(require,module,exports){
|
},{"jitsi-meet-logger":79}],44:[function(require,module,exports){
|
||||||
(function (__filename){
|
(function (__filename){
|
||||||
/* global $, APP, config, Strophe*/
|
/* global $, APP, config, Strophe */
|
||||||
|
|
||||||
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||||
var EventEmitter = require("events");
|
var EventEmitter = require("events");
|
||||||
|
@ -13176,18 +13176,14 @@ function createConnection(bosh) {
|
||||||
|
|
||||||
// Append token as URL param
|
// Append token as URL param
|
||||||
if (this.token) {
|
if (this.token) {
|
||||||
bosh += bosh.indexOf('?') == -1 ?
|
bosh += (bosh.indexOf('?') == -1 ? '?' : '&') + 'token=' + this.token;
|
||||||
'?token=' + this.token : '&token=' + this.token;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Strophe.Connection(bosh);
|
return new Strophe.Connection(bosh);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//!!!!!!!!!! FIXME: ...
|
//!!!!!!!!!! FIXME: ...
|
||||||
function initStrophePlugins(XMPP)
|
function initStrophePlugins(XMPP) {
|
||||||
{
|
|
||||||
require("./strophe.emuc")(XMPP);
|
require("./strophe.emuc")(XMPP);
|
||||||
require("./strophe.jingle")(XMPP, XMPP.eventEmitter);
|
require("./strophe.jingle")(XMPP, XMPP.eventEmitter);
|
||||||
// require("./strophe.moderate")(XMPP, eventEmitter);
|
// require("./strophe.moderate")(XMPP, eventEmitter);
|
||||||
|
@ -13226,13 +13222,18 @@ function XMPP(options) {
|
||||||
// registerListeners();
|
// registerListeners();
|
||||||
|
|
||||||
this.connection = createConnection(options.bosh);
|
this.connection = createConnection(options.bosh);
|
||||||
|
|
||||||
|
// Setup a disconnect on unload as a way to facilitate API consumers. It
|
||||||
|
// sounds like they would want that. A problem for them though may be if
|
||||||
|
// they wanted to utilize the connected connection in an unload handler of
|
||||||
|
// their own. However, it should be fairly easy for them to do that by
|
||||||
|
// registering their unload handler before us.
|
||||||
|
$(window).on('beforeunload unload', this.disconnect.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XMPP.prototype.getConnection = function () { return this.connection; };
|
||||||
XMPP.prototype.getConnection = function(){ return connection; };
|
|
||||||
|
|
||||||
XMPP.prototype._connect = function (jid, password) {
|
XMPP.prototype._connect = function (jid, password) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
// connection.connect() starts the connection process.
|
// connection.connect() starts the connection process.
|
||||||
//
|
//
|
||||||
|
@ -13272,7 +13273,6 @@ XMPP.prototype._connect = function (jid, password) {
|
||||||
self.connection.jingle.getStunAndTurnCredentials();
|
self.connection.jingle.getStunAndTurnCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger.info("My Jabber ID: " + self.connection.jid);
|
logger.info("My Jabber ID: " + self.connection.jid);
|
||||||
|
|
||||||
// Schedule ping ?
|
// Schedule ping ?
|
||||||
|
@ -13293,15 +13293,14 @@ XMPP.prototype._connect = function (jid, password) {
|
||||||
Strophe.getResourceFromJid(self.connection.jid)) {
|
Strophe.getResourceFromJid(self.connection.jid)) {
|
||||||
// .connected is true while connecting?
|
// .connected is true while connecting?
|
||||||
// self.connection.send($pres());
|
// self.connection.send($pres());
|
||||||
self.eventEmitter.emit(JitsiConnectionEvents.CONNECTION_ESTABLISHED,
|
self.eventEmitter.emit(
|
||||||
Strophe.getResourceFromJid(self.connection.jid));
|
JitsiConnectionEvents.CONNECTION_ESTABLISHED,
|
||||||
|
Strophe.getResourceFromJid(self.connection.jid));
|
||||||
}
|
}
|
||||||
} else if (status === Strophe.Status.CONNFAIL) {
|
} else if (status === Strophe.Status.CONNFAIL) {
|
||||||
if (msg === 'x-strophe-bad-non-anon-jid') {
|
if (msg === 'x-strophe-bad-non-anon-jid') {
|
||||||
anonymousConnectionFailed = true;
|
anonymousConnectionFailed = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
connectionFailed = true;
|
connectionFailed = true;
|
||||||
}
|
}
|
||||||
lastErrorMsg = msg;
|
lastErrorMsg = msg;
|
||||||
|
@ -13318,8 +13317,9 @@ XMPP.prototype._connect = function (jid, password) {
|
||||||
JitsiConnectionErrors.OTHER_ERROR,
|
JitsiConnectionErrors.OTHER_ERROR,
|
||||||
msg ? msg : lastErrorMsg);
|
msg ? msg : lastErrorMsg);
|
||||||
} else {
|
} else {
|
||||||
self.eventEmitter.emit(JitsiConnectionEvents.CONNECTION_DISCONNECTED,
|
self.eventEmitter.emit(
|
||||||
msg ? msg : lastErrorMsg);
|
JitsiConnectionEvents.CONNECTION_DISCONNECTED,
|
||||||
|
msg ? msg : lastErrorMsg);
|
||||||
}
|
}
|
||||||
} else if (status === Strophe.Status.AUTHFAIL) {
|
} else if (status === Strophe.Status.AUTHFAIL) {
|
||||||
// wrong password or username, prompt user
|
// wrong password or username, prompt user
|
||||||
|
@ -13331,11 +13331,12 @@ XMPP.prototype._connect = function (jid, password) {
|
||||||
}
|
}
|
||||||
|
|
||||||
XMPP.prototype.connect = function (jid, password) {
|
XMPP.prototype.connect = function (jid, password) {
|
||||||
if(!jid) {
|
if (!jid) {
|
||||||
var configDomain = this.options.hosts.anonymousdomain || this.options.hosts.domain;
|
var configDomain
|
||||||
|
= this.options.hosts.anonymousdomain || this.options.hosts.domain;
|
||||||
// Force authenticated domain if room is appended with '?login=true'
|
// Force authenticated domain if room is appended with '?login=true'
|
||||||
if (this.options.hosts.anonymousdomain &&
|
if (this.options.hosts.anonymousdomain
|
||||||
window.location.search.indexOf("login=true") !== -1) {
|
&& window.location.search.indexOf("login=true") !== -1) {
|
||||||
configDomain = this.options.hosts.domain;
|
configDomain = this.options.hosts.domain;
|
||||||
}
|
}
|
||||||
jid = configDomain || window.location.hostname;
|
jid = configDomain || window.location.hostname;
|
||||||
|
@ -13355,9 +13356,8 @@ XMPP.prototype.createRoom = function (roomName, options, settings) {
|
||||||
} else {
|
} else {
|
||||||
var tmpJid = Strophe.getNodeFromJid(this.connection.jid);
|
var tmpJid = Strophe.getNodeFromJid(this.connection.jid);
|
||||||
|
|
||||||
if(!authenticatedUser)
|
if (!authenticatedUser)
|
||||||
tmpJid = tmpJid.substr(0, 8);
|
tmpJid = tmpJid.substr(0, 8);
|
||||||
|
|
||||||
roomjid += '/' + tmpJid;
|
roomjid += '/' + tmpJid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13399,7 +13399,7 @@ XMPP.prototype.leaveRoom = function (jid) {
|
||||||
* @returns {boolean} true iff a message was sent.
|
* @returns {boolean} true iff a message was sent.
|
||||||
*/
|
*/
|
||||||
XMPP.prototype.sendLogs = function (data) {
|
XMPP.prototype.sendLogs = function (data) {
|
||||||
if(!this.connection.emuc.focusMucJid)
|
if (!this.connection.emuc.focusMucJid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var deflate = true;
|
var deflate = true;
|
||||||
|
@ -13411,8 +13411,7 @@ XMPP.prototype.sendLogs = function (data) {
|
||||||
content = Base64.encode(content);
|
content = Base64.encode(content);
|
||||||
// XEP-0337-ish
|
// XEP-0337-ish
|
||||||
var message = $msg({to: this.connection.emuc.focusMucJid, type: 'normal'});
|
var message = $msg({to: this.connection.emuc.focusMucJid, type: 'normal'});
|
||||||
message.c('log', { xmlns: 'urn:xmpp:eventlog',
|
message.c('log', {xmlns: 'urn:xmpp:eventlog', id: 'PeerConnectionStats'});
|
||||||
id: 'PeerConnectionStats'});
|
|
||||||
message.c('message').t(content).up();
|
message.c('message').t(content).up();
|
||||||
if (deflate) {
|
if (deflate) {
|
||||||
message.c('tag', {name: "deflated", value: "true"}).up();
|
message.c('tag', {name: "deflated", value: "true"}).up();
|
||||||
|
@ -13433,7 +13432,6 @@ XMPP.prototype.getXmppLog = function () {
|
||||||
return this.connection.logger ? this.connection.logger.log : null;
|
return this.connection.logger ? this.connection.logger.log : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
XMPP.prototype.dial = function (to, from, roomName,roomPass) {
|
XMPP.prototype.dial = function (to, from, roomName,roomPass) {
|
||||||
this.connection.rayo.dial(to, from, roomName,roomPass);
|
this.connection.rayo.dial(to, from, roomName,roomPass);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue