jsonrpc2-ws
Advanced tools
Comparing version 1.0.0-beta15 to 1.0.0-beta16
@@ -114,3 +114,3 @@ /// <reference types="node" /> | ||
/** (internal using for heartbeat) */ | ||
_lastPongAt: number; | ||
_pongAt: number; | ||
constructor(ws: WebSocket); | ||
@@ -117,0 +117,0 @@ /** |
@@ -81,3 +81,3 @@ "use strict"; | ||
ws.on("pong", function _onPongWS() { | ||
socket._lastPongAt = Date.now(); | ||
socket._pongAt = Date.now(); | ||
}); | ||
@@ -186,6 +186,7 @@ self.emit("connection", socket, req); | ||
for (const socket of this.sockets.values()) { | ||
if (socket._lastPongAt > deadline) { | ||
if (socket._pongAt === -1 || socket._pongAt > deadline) { | ||
socket.terminate(); | ||
continue; | ||
} | ||
socket._pongAt = -1; | ||
socket.ws.ping(); | ||
@@ -206,3 +207,3 @@ } | ||
/** (internal using for heartbeat) */ | ||
this._lastPongAt = 0; | ||
this._pongAt = 0; | ||
} | ||
@@ -209,0 +210,0 @@ /** |
{ | ||
"name": "jsonrpc2-ws", | ||
"version": "1.0.0-beta15", | ||
"version": "1.0.0-beta16", | ||
"description": "Yet Another Server Library which Implementation of JSON-RPC 2.0 over WebSocket for Node.js (w/ TypeScript)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
70114
1325