diff --git a/js/libtextsecure.js b/js/libtextsecure.js index e6cf78bc..8053efa5 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -39312,7 +39312,7 @@ MessageReceiver.prototype = { this.pending = Promise.resolve(); }, close: function() { - this.wsr.close(); + this.socket.close(3000, 'called close'); delete this.listeners; }, onopen: function() { @@ -39322,8 +39322,11 @@ MessageReceiver.prototype = { console.log('websocket error'); }, onclose: function(ev) { + console.log('websocket closed', ev.code, ev.reason || ''); + if (ev.code === 3000) { + return; + } var eventTarget = this; - console.log('websocket closed', ev.code); // possible 403 or network issue. Make an request to confirm this.server.getDevices(this.number). then(this.connect.bind(this)). // No HTTP error? Reconnect diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 2d6f39fd..55e65d19 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -32,7 +32,7 @@ MessageReceiver.prototype = { this.pending = Promise.resolve(); }, close: function() { - this.wsr.close(); + this.socket.close(3000, 'called close'); delete this.listeners; }, onopen: function() { @@ -42,8 +42,11 @@ MessageReceiver.prototype = { console.log('websocket error'); }, onclose: function(ev) { + console.log('websocket closed', ev.code, ev.reason || ''); + if (ev.code === 3000) { + return; + } var eventTarget = this; - console.log('websocket closed', ev.code); // possible 403 or network issue. Make an request to confirm this.server.getDevices(this.number). then(this.connect.bind(this)). // No HTTP error? Reconnect