From e3bd6951cf843ba5eb09d95a8d95b1534b5185a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Tue, 14 Apr 2020 14:09:37 +0200 Subject: [PATCH] Merge pull request #2735 from overleaf/jpa-try-ws-fallback-on-missing-js [frontend] ConnectionManager: use fallback backend on missing js blob GitOrigin-RevId: cd5acf17c67d7fd94641411842f31a17942f1385 --- services/web/frontend/js/ide/connection/ConnectionManager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web/frontend/js/ide/connection/ConnectionManager.js b/services/web/frontend/js/ide/connection/ConnectionManager.js index 7278504fb2..63e6884f0d 100644 --- a/services/web/frontend/js/ide/connection/ConnectionManager.js +++ b/services/web/frontend/js/ide/connection/ConnectionManager.js @@ -35,6 +35,11 @@ define([], function() { this.$scope = $scope this.wsUrl = ide.wsUrl || null // websocket url (if defined) if (typeof io === 'undefined' || io === null) { + if (this.wsUrl && !window.location.href.match(/ws=fallback/)) { + // if we tried to boot from a custom real-time backend and failed, + // try reloading and falling back to the siteUrl + window.location = window.location.href + '?ws=fallback' + } console.error( 'Socket.io javascript not loaded. Please check that the real-time service is running and accessible.' )