Merge branch 'sockjslikebunnies' of https://github.com/markwal/OctoPrint into pr/markwal/sockjslikebunnies

This commit is contained in:
Gina Häußge 2015-05-11 16:22:34 +02:00
commit 6029340f78
2 changed files with 7 additions and 1 deletions

View file

@ -22,6 +22,7 @@ function DataUpdater(allViewModels) {
};
self.reconnect = function() {
self._socket.close();
delete self._socket;
self.connect();
};
@ -31,7 +32,10 @@ function DataUpdater(allViewModels) {
self._autoReconnectTrial = 0;
};
self._onclose = function() {
self._onclose = function(e) {
if (e.code == SOCKJS_CLOSE_NORMAL) {
return;
}
if (self._autoReconnectTrial >= self._autoReconnectDialogIndex) {
// Only consider it a real disconnect if the trial number has exceeded our threshold.

View file

@ -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 }}";