Wrap all websocket errors, reconnect earlier

This commit is contained in:
Fedor Indutny 2021-06-14 17:12:58 -07:00 committed by GitHub
parent 8f5086227a
commit 584cedecff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 3 deletions

View file

@ -225,6 +225,20 @@ describe('WebSocket-Resource', () => {
this.clock.next();
});
it('optionally disconnects if suspended', function thisNeeded1(done) {
const socket = new FakeSocket();
sinon.stub(socket, 'close').callsFake(() => done());
new WebSocketResource(socket as WebSocket, {
keepalive: true,
});
// Just skip one hour immediately
this.clock.setSystemTime(NOW + 3600 * 1000);
this.clock.next();
});
it('allows resetting the keepalive timer', function thisNeeded2(done) {
const startTime = Date.now();