Simplify keepalive resets
Websocket resources should have their keepalive timers reset whenever a message comes in. This is a nicety that slightly reduces the amount of traffic we send when actively messaging. Previously this was handled by MessageReceiver, but it's a bit cleaner to just have the WebsocketResource add an extra 'message' event handler. // FREEBIE
This commit is contained in:
@@ -134,8 +134,9 @@
|
||||
path : opts.keepalive.path,
|
||||
disconnect : opts.keepalive.disconnect
|
||||
});
|
||||
this.resetKeepAliveTimer = keepalive.reset.bind(keepalive);
|
||||
socket.addEventListener('connect', this.resetKeepAliveTimer);
|
||||
var resetKeepAliveTimer = keepalive.reset.bind(keepalive);
|
||||
socket.addEventListener('connect', resetKeepAliveTimer);
|
||||
socket.addEventListener('message', resetKeepAliveTimer);
|
||||
socket.addEventListener('close', keepalive.stop.bind(keepalive));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user