mirror of
https://github.com/amark/gun.git
synced 2025-06-12 09:06:52 +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 !!!!!!!!!!!!!!!!!!!!!!");
|
//console.log("!!!!!!!!!!!!!!!! WARNING THIS IS GUN 0.5 !!!!!!!!!!!!!!!!!!!!!!");
|
||||||
;(function(){
|
;(function(){
|
||||||
|
|
||||||
/* UNBUILD */
|
/* UNBUILD */
|
||||||
var root;
|
var root;
|
||||||
@ -2236,13 +2236,9 @@
|
|||||||
client.on('message', msg);
|
client.on('message', msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reconnect on close events.
|
||||||
socket.addEventListener('close', function () {
|
socket.addEventListener('close', function () {
|
||||||
|
client.scheduleReconnect();
|
||||||
// Attempt reconnect if requests are pending.
|
|
||||||
if (client.queue.length) {
|
|
||||||
client.scheduleReconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send the messages in the queue.
|
// Send the messages in the queue.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user