diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 632f70f50f9..749d2e80377 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38461,8 +38461,9 @@ axolotlInternal.RecipientRecord = function() { 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)); } @@ -39261,7 +39262,6 @@ MessageReceiver.prototype = { }); }, handleRequest: function(request) { - this.wsr.resetKeepAliveTimer(); // TODO: handle different types of requests. for now we only expect // PUT /messages textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) { diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 67bfdc04edf..9c505730cb4 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -53,7 +53,6 @@ MessageReceiver.prototype = { }); }, handleRequest: function(request) { - this.wsr.resetKeepAliveTimer(); // TODO: handle different types of requests. for now we only expect // PUT /messages textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) { diff --git a/libtextsecure/websocket-resources.js b/libtextsecure/websocket-resources.js index 1fc269097ef..9b3cd653509 100644 --- a/libtextsecure/websocket-resources.js +++ b/libtextsecure/websocket-resources.js @@ -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)); }