Browse Source

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

j8
paweldomas 10 years ago
parent
commit
e16cee4187
3 changed files with 50 additions and 40 deletions
  1. 1
    1
      index.html
  2. 26
    20
      libs/app.bundle.js
  3. 23
    19
      modules/xmpp/moderator.js

+ 1
- 1
index.html View File

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

+ 26
- 20
libs/app.bundle.js View File

627
             // selections so that it can do adaptive simulcast,
627
             // selections so that it can do adaptive simulcast,
628
             // we want the notification to trigger even if userJid is undefined,
628
             // we want the notification to trigger even if userJid is undefined,
629
             // or null.
629
             // or null.
630
-            var userJid = APP.UI.getLargeVideoState().userJid;
630
+            var userJid = APP.UI.getLargeVideoState().userResourceJid;
631
             // we want the notification to trigger even if userJid is undefined,
631
             // we want the notification to trigger even if userJid is undefined,
632
             // or null.
632
             // or null.
633
             onSelectedEndpointChanged(userJid);
633
             onSelectedEndpointChanged(userJid);
785
         _dataChannels.some(function (dataChannel) {
785
         _dataChannels.some(function (dataChannel) {
786
             if (dataChannel.readyState == 'open')
786
             if (dataChannel.readyState == 'open')
787
             {
787
             {
788
+                console.log('sending selected endpoint changed ' 
789
+                    + 'notification to the bridge: ', userResource);
788
                 dataChannel.send(JSON.stringify({
790
                 dataChannel.send(JSON.stringify({
789
                     'colibriClass': 'SelectedEndpointChangedEvent',
791
                     'colibriClass': 'SelectedEndpointChangedEvent',
790
                     'selectedEndpoint':
792
                     'selectedEndpoint':
14695
 
14697
 
14696
 
14698
 
14697
 },{}],53:[function(require,module,exports){
14699
 },{}],53:[function(require,module,exports){
14698
-/* global $, $iq, config, connection, UI, messageHandler,
14700
+/* global $, $iq, APP, config, connection, UI, messageHandler,
14699
  roomName, sessionTerminated, Strophe, Util */
14701
  roomName, sessionTerminated, Strophe, Util */
14700
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
14702
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
14701
 var Settings = require("../settings/Settings");
14703
 var Settings = require("../settings/Settings");
14964
                 }
14966
                 }
14965
             },
14967
             },
14966
             function (error) {
14968
             function (error) {
14969
+                // Invalid session ? remove and try again
14970
+                // without session ID to get a new one
14971
+                var invalidSession
14972
+                    = $(error).find('>error>session-invalid').length;
14973
+                if (invalidSession) {
14974
+                    console.info("Session expired! - removing");
14975
+                    localStorage.removeItem("sessionId");
14976
+                }
14967
                 // Not authorized to create new room
14977
                 // Not authorized to create new room
14968
                 if ($(error).find('>error>not-authorized').length) {
14978
                 if ($(error).find('>error>not-authorized').length) {
14969
                     console.warn("Unauthorized to start the conference", error);
14979
                     console.warn("Unauthorized to start the conference", error);
14970
-
14971
-                    if ($(error).find('>error>session-invalid').length) {
14972
-                        // FIXME: just retry
14973
-                        console.info("Session expired! - removing");
14974
-                        localStorage.removeItem("sessionId");
14975
-                    }
14976
-
14977
                     var toDomain
14980
                     var toDomain
14978
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
14981
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
14979
                     if (toDomain === config.hosts.anonymousdomain) {
14982
                     if (toDomain === config.hosts.anonymousdomain) {
14980
                         // we are connected with anonymous domain and
14983
                         // we are connected with anonymous domain and
14981
                         // only non anonymous users can create rooms
14984
                         // only non anonymous users can create rooms
14982
                         // we must authorize the user
14985
                         // we must authorize the user
14983
-
14984
                         self.xmppService.promptLogin();
14986
                         self.xmppService.promptLogin();
14985
                     } else {
14987
                     } else {
14986
-
14987
-                        eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
14988
+                        // External authentication mode
14989
+                        eventEmitter.emit(
14990
+                            XMPPEvents.AUTHENTICATION_REQUIRED,
14988
                             function () {
14991
                             function () {
14989
                                 Moderator.allocateConferenceFocus(
14992
                                 Moderator.allocateConferenceFocus(
14990
                                     roomName, callback);
14993
                                     roomName, callback);
14991
                             });
14994
                             });
14992
-
14993
                     }
14995
                     }
14994
                     return;
14996
                     return;
14995
                 }
14997
                 }
14996
                 var waitMs = getNextErrorTimeout();
14998
                 var waitMs = getNextErrorTimeout();
14997
                 console.error("Focus error, retry after " + waitMs, error);
14999
                 console.error("Focus error, retry after " + waitMs, error);
14998
                 // Show message
15000
                 // Show message
14999
-                APP.UI.messageHandler.notify( null, "notify.focus",
15000
-                    'Conference focus', 'disconnected',"notify.focusFail",
15001
-                        Moderator.getFocusComponent() +
15002
-                        ' not available - retry in ' +
15003
-                        (waitMs / 1000) + ' sec',
15004
-                    {component: Moderator.getFocusComponent(),
15005
-                        ms: (waitMs / 1000)});
15001
+                var focusComponent = Moderator.getFocusComponent();
15002
+                var retrySec = waitMs / 1000;
15003
+                // FIXME: message is duplicated ?
15004
+                // Do not show in case of session invalid
15005
+                // which means just a retry
15006
+                if (!invalidSession) {
15007
+                    APP.UI.messageHandler.notify(
15008
+                        null, "notify.focus",
15009
+                        'Conference focus', 'disconnected', "notify.focusFail",
15010
+                        {component: focusComponent, ms: retrySec});
15011
+                }
15006
                 // Reset response timeout
15012
                 // Reset response timeout
15007
                 getNextTimeout(true);
15013
                 getNextTimeout(true);
15008
                 window.setTimeout(
15014
                 window.setTimeout(

+ 23
- 19
modules/xmpp/moderator.js View File

1
-/* global $, $iq, config, connection, UI, messageHandler,
1
+/* global $, $iq, APP, config, connection, UI, messageHandler,
2
  roomName, sessionTerminated, Strophe, Util */
2
  roomName, sessionTerminated, Strophe, Util */
3
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
3
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4
 var Settings = require("../settings/Settings");
4
 var Settings = require("../settings/Settings");
267
                 }
267
                 }
268
             },
268
             },
269
             function (error) {
269
             function (error) {
270
+                // Invalid session ? remove and try again
271
+                // without session ID to get a new one
272
+                var invalidSession
273
+                    = $(error).find('>error>session-invalid').length;
274
+                if (invalidSession) {
275
+                    console.info("Session expired! - removing");
276
+                    localStorage.removeItem("sessionId");
277
+                }
270
                 // Not authorized to create new room
278
                 // Not authorized to create new room
271
                 if ($(error).find('>error>not-authorized').length) {
279
                 if ($(error).find('>error>not-authorized').length) {
272
                     console.warn("Unauthorized to start the conference", error);
280
                     console.warn("Unauthorized to start the conference", error);
273
-
274
-                    if ($(error).find('>error>session-invalid').length) {
275
-                        // FIXME: just retry
276
-                        console.info("Session expired! - removing");
277
-                        localStorage.removeItem("sessionId");
278
-                    }
279
-
280
                     var toDomain
281
                     var toDomain
281
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
282
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
282
                     if (toDomain === config.hosts.anonymousdomain) {
283
                     if (toDomain === config.hosts.anonymousdomain) {
283
                         // we are connected with anonymous domain and
284
                         // we are connected with anonymous domain and
284
                         // only non anonymous users can create rooms
285
                         // only non anonymous users can create rooms
285
                         // we must authorize the user
286
                         // we must authorize the user
286
-
287
                         self.xmppService.promptLogin();
287
                         self.xmppService.promptLogin();
288
                     } else {
288
                     } else {
289
-
290
-                        eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
289
+                        // External authentication mode
290
+                        eventEmitter.emit(
291
+                            XMPPEvents.AUTHENTICATION_REQUIRED,
291
                             function () {
292
                             function () {
292
                                 Moderator.allocateConferenceFocus(
293
                                 Moderator.allocateConferenceFocus(
293
                                     roomName, callback);
294
                                     roomName, callback);
294
                             });
295
                             });
295
-
296
                     }
296
                     }
297
                     return;
297
                     return;
298
                 }
298
                 }
299
                 var waitMs = getNextErrorTimeout();
299
                 var waitMs = getNextErrorTimeout();
300
                 console.error("Focus error, retry after " + waitMs, error);
300
                 console.error("Focus error, retry after " + waitMs, error);
301
                 // Show message
301
                 // Show message
302
-                APP.UI.messageHandler.notify( null, "notify.focus",
303
-                    'Conference focus', 'disconnected',"notify.focusFail",
304
-                        Moderator.getFocusComponent() +
305
-                        ' not available - retry in ' +
306
-                        (waitMs / 1000) + ' sec',
307
-                    {component: Moderator.getFocusComponent(),
308
-                        ms: (waitMs / 1000)});
302
+                var focusComponent = Moderator.getFocusComponent();
303
+                var retrySec = waitMs / 1000;
304
+                // FIXME: message is duplicated ?
305
+                // Do not show in case of session invalid
306
+                // which means just a retry
307
+                if (!invalidSession) {
308
+                    APP.UI.messageHandler.notify(
309
+                        null, "notify.focus",
310
+                        'Conference focus', 'disconnected', "notify.focusFail",
311
+                        {component: focusComponent, ms: retrySec});
312
+                }
309
                 // Reset response timeout
313
                 // Reset response timeout
310
                 getNextTimeout(true);
314
                 getNextTimeout(true);
311
                 window.setTimeout(
315
                 window.setTimeout(

Loading…
Cancel
Save