|
|
|
@ -61,8 +61,7 @@ var MovimWebsocket = { |
|
|
|
var uri = 'ws:' + BASE_URI + 'ws/'; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.connection |
|
|
|
&& this.connection.readyState == 1) { |
|
|
|
if (typeof this.connection === 'object') { |
|
|
|
this.connection.onclose = null; |
|
|
|
this.connection.close(); |
|
|
|
} |
|
|
|
@ -275,3 +274,10 @@ document.addEventListener("DOMContentLoaded", function(event) { |
|
|
|
// And we start it
|
|
|
|
MovimWebsocket.init(); |
|
|
|
}); |
|
|
|
|
|
|
|
// If the Websocket was closed after some innactivity, we try to reconnect
|
|
|
|
window.addEventListener('focus', function() { |
|
|
|
if (MovimWebsocket.connection.readyState > 1) { |
|
|
|
MovimWebsocket.init(); |
|
|
|
} |
|
|
|
}); |