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/toastr.js?v=1"></script><!-- notifications lib -->
<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 -->
<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,
// we want the notification to trigger even if userJid is undefined,
// 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,
// or null.
onSelectedEndpointChanged(userJid);
@ -785,6 +785,8 @@ function onSelectedEndpointChanged(userResource)
_dataChannels.some(function (dataChannel) {
if (dataChannel.readyState == 'open')
{
console.log('sending selected endpoint changed '
+ 'notification to the bridge: ', userResource);
dataChannel.send(JSON.stringify({
'colibriClass': 'SelectedEndpointChangedEvent',
'selectedEndpoint':
@ -14695,7 +14697,7 @@ module.exports = TraceablePeerConnection;
},{}],53:[function(require,module,exports){
/* global $, $iq, config, connection, UI, messageHandler,
/* global $, $iq, APP, config, connection, UI, messageHandler,
roomName, sessionTerminated, Strophe, Util */
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var Settings = require("../settings/Settings");
@ -14964,45 +14966,49 @@ var Moderator = {
}
},
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
if ($(error).find('>error>not-authorized').length) {
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
= Strophe.getDomainFromJid(error.getAttribute('to'));
if (toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and
// only non anonymous users can create rooms
// we must authorize the user
self.xmppService.promptLogin();
} else {
eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
// External authentication mode
eventEmitter.emit(
XMPPEvents.AUTHENTICATION_REQUIRED,
function () {
Moderator.allocateConferenceFocus(
roomName, callback);
});
}
return;
}
var waitMs = getNextErrorTimeout();
console.error("Focus error, retry after " + waitMs, error);
// Show message
APP.UI.messageHandler.notify( null, "notify.focus",
'Conference focus', 'disconnected',"notify.focusFail",
Moderator.getFocusComponent() +
' not available - retry in ' +
(waitMs / 1000) + ' sec',
{component: Moderator.getFocusComponent(),
ms: (waitMs / 1000)});
var focusComponent = Moderator.getFocusComponent();
var retrySec = waitMs / 1000;
// FIXME: message is duplicated ?
// Do not show in case of session invalid
// which means just a retry
if (!invalidSession) {
APP.UI.messageHandler.notify(
null, "notify.focus",
'Conference focus', 'disconnected', "notify.focusFail",
{component: focusComponent, ms: retrySec});
}
// Reset response timeout
getNextTimeout(true);
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 */
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
var Settings = require("../settings/Settings");
@ -267,45 +267,49 @@ var Moderator = {
}
},
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
if ($(error).find('>error>not-authorized').length) {
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
= Strophe.getDomainFromJid(error.getAttribute('to'));
if (toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and
// only non anonymous users can create rooms
// we must authorize the user
self.xmppService.promptLogin();
} else {
eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
// External authentication mode
eventEmitter.emit(
XMPPEvents.AUTHENTICATION_REQUIRED,
function () {
Moderator.allocateConferenceFocus(
roomName, callback);
});
}
return;
}
var waitMs = getNextErrorTimeout();
console.error("Focus error, retry after " + waitMs, error);
// Show message
APP.UI.messageHandler.notify( null, "notify.focus",
'Conference focus', 'disconnected',"notify.focusFail",
Moderator.getFocusComponent() +
' not available - retry in ' +
(waitMs / 1000) + ' sec',
{component: Moderator.getFocusComponent(),
ms: (waitMs / 1000)});
var focusComponent = Moderator.getFocusComponent();
var retrySec = waitMs / 1000;
// FIXME: message is duplicated ?
// Do not show in case of session invalid
// which means just a retry
if (!invalidSession) {
APP.UI.messageHandler.notify(
null, "notify.focus",
'Conference focus', 'disconnected', "notify.focusFail",
{component: focusComponent, ms: retrySec});
}
// Reset response timeout
getNextTimeout(true);
window.setTimeout(