mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for broken websocket ping/pong implementation in browsers
Now use a normal message to keep the connection alive. Avoids the annoying error messages in the console when the browser times out the connection.
This commit is contained in:
parent
388c6859bb
commit
3e70e190dd
@ -33,7 +33,7 @@
|
||||
};
|
||||
|
||||
self.ws.onmessage = function(event) {
|
||||
console.log('Received mesasge from reload server: ' + event.data);
|
||||
if (event.data !== 'ping') console.log('Received mesasge from reload server: ' + event.data);
|
||||
if (event.data === 'reload') window.location.reload(true);
|
||||
};
|
||||
|
||||
|
@ -253,7 +253,7 @@ class Worker(object):
|
||||
def ping_thread(self):
|
||||
while True:
|
||||
self.server.ping()
|
||||
time.sleep(0.9 * self.connection_timeout)
|
||||
time.sleep(30)
|
||||
|
||||
def __enter__(self):
|
||||
self.restart()
|
||||
@ -341,7 +341,7 @@ class ReloadHandler(DummyHandler):
|
||||
for connref in self.connections.itervalues():
|
||||
conn = connref()
|
||||
if conn is not None and conn.ready:
|
||||
conn.send_websocket_ping()
|
||||
conn.send_websocket_message('ping')
|
||||
|
||||
|
||||
class ReloadServer(Thread):
|
||||
|
Loading…
x
Reference in New Issue
Block a user