Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Does not disconnect from the XMPP server on unload in jitsi-meet-new because the API has taken on that responsibility.
Lyubomir Marinovfeb0abf70191
diff --git a/conference.js b/conference.jsindex b1c55e1f4c..7bb017ba71 100644--- a/conference.js+++ b/conference.js@@ -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.* @param {string} id user id@@ -247,8 +234,8 @@ export default {localTracks = tracks;connection = con;this._createRoom();- $(window).bind('beforeunload', unload );- $(window).bind('unload', unload );+ // XXX The API will take care of disconnecting from the XMPP server+ // (and, thus, leaving the room) on unload.return new Promise((resolve, reject) => {(new ConferenceConnector(resolve, reject)).connect();});diff --git a/libs/lib-jitsi-meet.js b/libs/lib-jitsi-meet.jsindex 60820aff39..0d6a1947a9 100644--- a/libs/lib-jitsi-meet.js+++ b/libs/lib-jitsi-meet.js@@ -13158,7 +13158,7 @@ module.exports = function () {}).call(this,"/modules/xmpp/strophe.util.js")},{"jitsi-meet-logger":79}],44:[function(require,module,exports){(function (__filename){-/* global $, APP, config, Strophe*/+/* global $, APP, config, Strophe */var logger = require("jitsi-meet-logger").getLogger(__filename);var EventEmitter = require("events");@@ -13176,18 +13176,14 @@ function createConnection(bosh) {// Append token as URL paramif (this.token) {- bosh += bosh.indexOf('?') == -1 ?- '?token=' + this.token : '&token=' + this.token;+ bosh += (bosh.indexOf('?') == -1 ? '?' : '&') + 'token=' + this.token;}return new Strophe.Connection(bosh);};--//!!!!!!!!!! FIXME: ...-function initStrophePlugins(XMPP)-{+function initStrophePlugins(XMPP) {require("./strophe.emuc")(XMPP);require("./strophe.jingle")(XMPP, XMPP.eventEmitter);// require("./strophe.moderate")(XMPP, eventEmitter);@@ -13226,13 +13222,18 @@ function XMPP(options) {// registerListeners();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 connection; };+XMPP.prototype.getConnection = function () { return this.connection; };XMPP.prototype._connect = function (jid, password) {-var self = this;// connection.connect() starts the connection process.//@@ -13272,7 +13273,6 @@ XMPP.prototype._connect = function (jid, password) {self.connection.jingle.getStunAndTurnCredentials();}-logger.info("My Jabber ID: " + self.connection.jid);// Schedule ping ?@@ -13293,15 +13293,14 @@ XMPP.prototype._connect = function (jid, password) {Strophe.getResourceFromJid(self.connection.jid)) {// .connected is true while connecting?// self.connection.send($pres());- self.eventEmitter.emit(JitsiConnectionEvents.CONNECTION_ESTABLISHED,- Strophe.getResourceFromJid(self.connection.jid));+ self.eventEmitter.emit(+ JitsiConnectionEvents.CONNECTION_ESTABLISHED,+ Strophe.getResourceFromJid(self.connection.jid));}} else if (status === Strophe.Status.CONNFAIL) {if (msg === 'x-strophe-bad-non-anon-jid') {anonymousConnectionFailed = true;- }- else- {+ } else {connectionFailed = true;}lastErrorMsg = msg;@@ -13318,8 +13317,9 @@ XMPP.prototype._connect = function (jid, password) {JitsiConnectionErrors.OTHER_ERROR,msg ? msg : lastErrorMsg);} else {- self.eventEmitter.emit(JitsiConnectionEvents.CONNECTION_DISCONNECTED,- msg ? msg : lastErrorMsg);+ self.eventEmitter.emit(+ JitsiConnectionEvents.CONNECTION_DISCONNECTED,+ msg ? msg : lastErrorMsg);}} else if (status === Strophe.Status.AUTHFAIL) {// wrong password or username, prompt user@@ -13331,11 +13331,12 @@ XMPP.prototype._connect = function (jid, password) {}XMPP.prototype.connect = function (jid, password) {- if(!jid) {- var configDomain = this.options.hosts.anonymousdomain || this.options.hosts.domain;+ if (!jid) {+ var configDomain+ = this.options.hosts.anonymousdomain || this.options.hosts.domain;// Force authenticated domain if room is appended with '?login=true'- if (this.options.hosts.anonymousdomain &&- window.location.search.indexOf("login=true") !== -1) {+ if (this.options.hosts.anonymousdomain+ && window.location.search.indexOf("login=true") !== -1) {configDomain = this.options.hosts.domain;}jid = configDomain || window.location.hostname;@@ -13355,9 +13356,8 @@ XMPP.prototype.createRoom = function (roomName, options, settings) {} else {var tmpJid = Strophe.getNodeFromJid(this.connection.jid);- if(!authenticatedUser)+ if (!authenticatedUser)tmpJid = tmpJid.substr(0, 8);-roomjid += '/' + tmpJid;}@@ -13399,7 +13399,7 @@ XMPP.prototype.leaveRoom = function (jid) {* @returns {boolean} true iff a message was sent.*/XMPP.prototype.sendLogs = function (data) {- if(!this.connection.emuc.focusMucJid)+ if (!this.connection.emuc.focusMucJid)return false;var deflate = true;@@ -13411,8 +13411,7 @@ XMPP.prototype.sendLogs = function (data) {content = Base64.encode(content);// XEP-0337-ishvar message = $msg({to: this.connection.emuc.focusMucJid, type: 'normal'});- message.c('log', { xmlns: 'urn:xmpp:eventlog',- id: 'PeerConnectionStats'});+ message.c('log', {xmlns: 'urn:xmpp:eventlog', id: 'PeerConnectionStats'});message.c('message').t(content).up();if (deflate) {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;};-XMPP.prototype.dial = function (to, from, roomName,roomPass) {this.connection.rayo.dial(to, from, roomName,roomPass);};