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
This commit is contained in:
Timothée Alby 2020-04-14 14:09:37 +02:00 committed by Copybot
parent e54618e7de
commit e3bd6951cf

View file

@ -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.'
)