Delete old session ID and retry on 'session-invalid' response. Updates app.bundle.js.

This commit is contained in:
paweldomas 2015-02-19 13:56:04 +01:00
parent a904e35c67
commit e16cee4187
3 changed files with 50 additions and 40 deletions

View File

@ -19,7 +19,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib --> <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib --> <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script> <script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=12"></script> <script src="libs/app.bundle.js?v=13"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin --> <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=6"/> <link rel="stylesheet" href="css/font.css?v=6"/>

View File

@ -627,7 +627,7 @@ var DataChannels =
// selections so that it can do adaptive simulcast, // selections so that it can do adaptive simulcast,
// we want the notification to trigger even if userJid is undefined, // we want the notification to trigger even if userJid is undefined,
// or null. // or null.
var userJid = APP.UI.getLargeVideoState().userJid; var userJid = APP.UI.getLargeVideoState().userResourceJid;
// we want the notification to trigger even if userJid is undefined, // we want the notification to trigger even if userJid is undefined,
// or null. // or null.
onSelectedEndpointChanged(userJid); onSelectedEndpointChanged(userJid);
@ -785,6 +785,8 @@ function onSelectedEndpointChanged(userResource)
_dataChannels.some(function (dataChannel) { _dataChannels.some(function (dataChannel) {
if (dataChannel.readyState == 'open') if (dataChannel.readyState == 'open')
{ {
console.log('sending selected endpoint changed '
+ 'notification to the bridge: ', userResource);
dataChannel.send(JSON.stringify({ dataChannel.send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent', 'colibriClass': 'SelectedEndpointChangedEvent',
'selectedEndpoint': 'selectedEndpoint':
@ -14695,7 +14697,7 @@ module.exports = TraceablePeerConnection;
},{}],53:[function(require,module,exports){ },{}],53:[function(require,module,exports){
/* global $, $iq, config, connection, UI, messageHandler, /* global $, $iq, APP, config, connection, UI, messageHandler,
roomName, sessionTerminated, Strophe, Util */ roomName, sessionTerminated, Strophe, Util */
var XMPPEvents = require("../../service/xmpp/XMPPEvents"); var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var Settings = require("../settings/Settings"); var Settings = require("../settings/Settings");
@ -14964,45 +14966,49 @@ var Moderator = {
} }
}, },
function (error) { function (error) {
// Invalid session ? remove and try again
// without session ID to get a new one
var invalidSession
= $(error).find('>error>session-invalid').length;
if (invalidSession) {
console.info("Session expired! - removing");
localStorage.removeItem("sessionId");
}
// Not authorized to create new room // Not authorized to create new room
if ($(error).find('>error>not-authorized').length) { if ($(error).find('>error>not-authorized').length) {
console.warn("Unauthorized to start the conference", error); console.warn("Unauthorized to start the conference", error);
if ($(error).find('>error>session-invalid').length) {
// FIXME: just retry
console.info("Session expired! - removing");
localStorage.removeItem("sessionId");
}
var toDomain var toDomain
= Strophe.getDomainFromJid(error.getAttribute('to')); = Strophe.getDomainFromJid(error.getAttribute('to'));
if (toDomain === config.hosts.anonymousdomain) { if (toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and // we are connected with anonymous domain and
// only non anonymous users can create rooms // only non anonymous users can create rooms
// we must authorize the user // we must authorize the user
self.xmppService.promptLogin(); self.xmppService.promptLogin();
} else { } else {
// External authentication mode
eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode eventEmitter.emit(
XMPPEvents.AUTHENTICATION_REQUIRED,
function () { function () {
Moderator.allocateConferenceFocus( Moderator.allocateConferenceFocus(
roomName, callback); roomName, callback);
}); });
} }
return; return;
} }
var waitMs = getNextErrorTimeout(); var waitMs = getNextErrorTimeout();
console.error("Focus error, retry after " + waitMs, error); console.error("Focus error, retry after " + waitMs, error);
// Show message // Show message
APP.UI.messageHandler.notify( null, "notify.focus", var focusComponent = Moderator.getFocusComponent();
'Conference focus', 'disconnected',"notify.focusFail", var retrySec = waitMs / 1000;
Moderator.getFocusComponent() + // FIXME: message is duplicated ?
' not available - retry in ' + // Do not show in case of session invalid
(waitMs / 1000) + ' sec', // which means just a retry
{component: Moderator.getFocusComponent(), if (!invalidSession) {
ms: (waitMs / 1000)}); APP.UI.messageHandler.notify(
null, "notify.focus",
'Conference focus', 'disconnected', "notify.focusFail",
{component: focusComponent, ms: retrySec});
}
// Reset response timeout // Reset response timeout
getNextTimeout(true); getNextTimeout(true);
window.setTimeout( window.setTimeout(

View File

@ -1,4 +1,4 @@
/* global $, $iq, config, connection, UI, messageHandler, /* global $, $iq, APP, config, connection, UI, messageHandler,
roomName, sessionTerminated, Strophe, Util */ roomName, sessionTerminated, Strophe, Util */
var XMPPEvents = require("../../service/xmpp/XMPPEvents"); var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var Settings = require("../settings/Settings"); var Settings = require("../settings/Settings");
@ -267,45 +267,49 @@ var Moderator = {
} }
}, },
function (error) { function (error) {
// Invalid session ? remove and try again
// without session ID to get a new one
var invalidSession
= $(error).find('>error>session-invalid').length;
if (invalidSession) {
console.info("Session expired! - removing");
localStorage.removeItem("sessionId");
}
// Not authorized to create new room // Not authorized to create new room
if ($(error).find('>error>not-authorized').length) { if ($(error).find('>error>not-authorized').length) {
console.warn("Unauthorized to start the conference", error); console.warn("Unauthorized to start the conference", error);
if ($(error).find('>error>session-invalid').length) {
// FIXME: just retry
console.info("Session expired! - removing");
localStorage.removeItem("sessionId");
}
var toDomain var toDomain
= Strophe.getDomainFromJid(error.getAttribute('to')); = Strophe.getDomainFromJid(error.getAttribute('to'));
if (toDomain === config.hosts.anonymousdomain) { if (toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and // we are connected with anonymous domain and
// only non anonymous users can create rooms // only non anonymous users can create rooms
// we must authorize the user // we must authorize the user
self.xmppService.promptLogin(); self.xmppService.promptLogin();
} else { } else {
// External authentication mode
eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode eventEmitter.emit(
XMPPEvents.AUTHENTICATION_REQUIRED,
function () { function () {
Moderator.allocateConferenceFocus( Moderator.allocateConferenceFocus(
roomName, callback); roomName, callback);
}); });
} }
return; return;
} }
var waitMs = getNextErrorTimeout(); var waitMs = getNextErrorTimeout();
console.error("Focus error, retry after " + waitMs, error); console.error("Focus error, retry after " + waitMs, error);
// Show message // Show message
APP.UI.messageHandler.notify( null, "notify.focus", var focusComponent = Moderator.getFocusComponent();
'Conference focus', 'disconnected',"notify.focusFail", var retrySec = waitMs / 1000;
Moderator.getFocusComponent() + // FIXME: message is duplicated ?
' not available - retry in ' + // Do not show in case of session invalid
(waitMs / 1000) + ' sec', // which means just a retry
{component: Moderator.getFocusComponent(), if (!invalidSession) {
ms: (waitMs / 1000)}); APP.UI.messageHandler.notify(
null, "notify.focus",
'Conference focus', 'disconnected', "notify.focusFail",
{component: focusComponent, ms: retrySec});
}
// Reset response timeout // Reset response timeout
getNextTimeout(true); getNextTimeout(true);
window.setTimeout( window.setTimeout(