Skip to content

Commit

Permalink
The socket reported erroneously timeouts once the connection has been…
Browse files Browse the repository at this point in the history
… established.

This was simply due to inactivity on that socket.
I disabled the timeout once the connection is established so that the keepalive mechanism of ember can take place.
  • Loading branch information
BIALOBOS, Christophe committed Jan 17, 2019
1 parent 963026c commit 5f6a8e7
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ S101Socket.prototype.connect = function (timeout = 2) {
self.keepaliveIntervalTimer = setInterval(() => {
try {
self.sendKeepaliveRequest();
}
catch(e) {
} catch (e) {
self.emit("error", e);
}
}, 1000 * self.keepaliveInterval);
Expand All @@ -211,20 +210,22 @@ S101Socket.prototype.connect = function (timeout = 2) {
});

self.emit('connected');
}
).on('error', (e) => {
self.emit("error", e);
}).once("timeout", connectTimeoutListener
).on('data', (data) => {
if (self.isConnected()) {
self.codec.dataIn(data);
}
}).on('close', () => {
clearInterval(self.keepaliveIntervalTimer);
self.emit('disconnected');
self.status = "disconnected";
self.socket = null;
});
})
.on('error', (e) => {
self.emit("error", e);
})
.once("timeout", connectTimeoutListener)
.on('data', (data) => {
if (self.isConnected()) {
self.codec.dataIn(data);
}
})
.on('close', () => {
clearInterval(self.keepaliveIntervalTimer);
self.emit('disconnected');
self.status = "disconnected";
self.socket = null;
});
}

S101Socket.prototype.isConnected = function () {
Expand Down

0 comments on commit 5f6a8e7

Please sign in to comment.