diff --git a/src/octoprint/static/js/app/dataupdater.js b/src/octoprint/static/js/app/dataupdater.js index 4172b459..73a4a6d2 100644 --- a/src/octoprint/static/js/app/dataupdater.js +++ b/src/octoprint/static/js/app/dataupdater.js @@ -33,8 +33,7 @@ function DataUpdater(allViewModels) { }; self._onclose = function(e) { - if (e.code == 1000) { - // it was us calling close + if (e.code == SOCKJS_CLOSE_NORMAL) { return; } if (self._autoReconnectTrial >= self._autoReconnectDialogIndex) { diff --git a/src/octoprint/templates/initscript.jinja2 b/src/octoprint/templates/initscript.jinja2 index 2351db39..4d8094a8 100644 --- a/src/octoprint/templates/initscript.jinja2 +++ b/src/octoprint/templates/initscript.jinja2 @@ -20,6 +20,8 @@ var SOCKJS_URI = "{{ url_for('index') }}" + "sockjs"; var SOCKJS_DEBUG = CONFIG_DEBUG; + // sockjs should define CLOSE_NORMAL for us, but they don't (from ws spec) + var SOCKJS_CLOSE_NORMAL = 1000 var UI_API_KEY = "{{ uiApiKey }}"; var VERSION = "{{ version }}";