mirror of
https://github.com/amark/gun.git
synced 2025-06-10 16:16:49 +00:00
Attempt reconnect on disconnect
Previously, the client websocket layer would only attempt a reconnection if there were pending messages in the queue. Now it will always attempt a reconnection, solving most of issue #259 (although not completely, as reconnects are susceptible to race conditions).
This commit is contained in:
parent
304265e193
commit
ba673f73f8
10
gun.js
10
gun.js
@ -1,5 +1,5 @@
|
||||
//console.log("!!!!!!!!!!!!!!!! WARNING THIS IS GUN 0.5 !!!!!!!!!!!!!!!!!!!!!!");
|
||||
;(function(){
|
||||
;(function(){
|
||||
|
||||
/* UNBUILD */
|
||||
var root;
|
||||
@ -2236,13 +2236,9 @@
|
||||
client.on('message', msg);
|
||||
});
|
||||
|
||||
// Reconnect on close events.
|
||||
socket.addEventListener('close', function () {
|
||||
|
||||
// Attempt reconnect if requests are pending.
|
||||
if (client.queue.length) {
|
||||
client.scheduleReconnect();
|
||||
}
|
||||
|
||||
client.scheduleReconnect();
|
||||
});
|
||||
|
||||
// Send the messages in the queue.
|
||||
|
Loading…
x
Reference in New Issue
Block a user