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:
Jesse Gibson 2016-12-13 13:37:43 -07:00
parent 304265e193
commit ba673f73f8

10
gun.js
View File

@ -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.