resilient-websocket
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -39,2 +39,3 @@ export interface OnCallback { | ||
close: () => void; | ||
private cleanup; | ||
on: (event: WebSocketEvent, callback: OnCallback) => void; | ||
@@ -41,0 +42,0 @@ off: (event: WebSocketEvent, callback: OnCallback) => void; |
@@ -53,2 +53,7 @@ "use strict"; | ||
this.close = function () { | ||
_this.socket.close(); | ||
_this.respondToCallbacks(WebSocketEvent.CLOSE, _this); | ||
_this.cleanup(); | ||
}; | ||
this.cleanup = function () { | ||
clearTimeout(_this.pongTimeout); | ||
@@ -60,4 +65,2 @@ clearInterval(_this.pingTimeout); | ||
_this.socket.removeEventListener('close', _this.onClose); | ||
_this.socket.close(); | ||
_this.respondToCallbacks(WebSocketEvent.CLOSE, _this); | ||
}; | ||
@@ -118,5 +121,4 @@ this.on = function (event, callback) { | ||
this.onClose = function (event) { | ||
_this.cleanup(); | ||
_this.respondToCallbacks(WebSocketEvent.CLOSE, event); | ||
clearInterval(_this.pingTimeout); | ||
clearTimeout(_this.pongTimeout); | ||
setTimeout(function () { | ||
@@ -123,0 +125,0 @@ _this.socket = _this.connect(); |
{ | ||
"name": "resilient-websocket", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "A client WebSocket wrapper with support for reconnection and ping/pong", | ||
@@ -5,0 +5,0 @@ "main": "dist/ResilientWebSocket.js", |
Sorry, the diff of this file is not supported yet
30320
221