Change default for keepalive autodisconnect config

By default, automatically disconnect if no response. This is preferable
because we can sometimes lose connectivity without receiving a close
event from the socket, but it's also possible that the endpoint may not
support responses.

// FREEBIE
This commit is contained in:
lilia 2015-07-29 10:51:33 -07:00
parent fdad87b6a0
commit 2b563212b4
3 changed files with 7 additions and 9 deletions

View file

@ -38636,7 +38636,7 @@ TextSecureWebSocket = function (url, opts) {
} }
this.disconnect = opts.disconnect; this.disconnect = opts.disconnect;
if (this.disconnect === undefined) { if (this.disconnect === undefined) {
this.disconnect = false; this.disconnect = true;
} }
this.wsr = websocketResource; this.wsr = websocketResource;
this.reset(); this.reset();

View file

@ -128,8 +128,8 @@
done(); done();
}); });
}); });
var resource = new WebSocketResource(new WebSocket('ws://localhost:8081'), { new WebSocketResource(new WebSocket('ws://localhost:8081'), {
keepalive: { path: '/v1/keepalive', disconnect: true } keepalive: { path: '/v1/keepalive' }
}); });
}); });
@ -145,8 +145,8 @@
done(); done();
}); });
}); });
var resource = new WebSocketResource(new WebSocket('ws://localhost:8081'), { new WebSocketResource(new WebSocket('ws://localhost:8081'), {
keepalive: { disconnect: true } keepalive: true
}); });
}); });
@ -158,9 +158,7 @@
mockServer.on('connection', function(server) { mockServer.on('connection', function(server) {
server.on('close', done); server.on('close', done);
}); });
var resource = new WebSocketResource(socket, { new WebSocketResource(socket, { keepalive: true });
keepalive: { disconnect: true }
});
}); });
it('allows resetting the keepalive timer', function(done) { it('allows resetting the keepalive timer', function(done) {

View file

@ -165,7 +165,7 @@
} }
this.disconnect = opts.disconnect; this.disconnect = opts.disconnect;
if (this.disconnect === undefined) { if (this.disconnect === undefined) {
this.disconnect = false; this.disconnect = true;
} }
this.wsr = websocketResource; this.wsr = websocketResource;
this.reset(); this.reset();