From 903496d8fd22a302e02662c3c9cc66233ed6a58d Mon Sep 17 00:00:00 2001 From: Hans Date: Tue, 19 May 2020 18:08:14 +0800 Subject: [PATCH] Add WebSocket ping and pong hook --- server/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/index.js b/server/index.js index 9fa9985..d4740a4 100644 --- a/server/index.js +++ b/server/index.js @@ -320,6 +320,12 @@ class fastWS { drain: (ws) => { ws.client.drain() }, + ping: (ws) => { + ws.client.onPing() + }, + pong: (ws) => { + ws.client.onPong() + }, close: (ws, code, message) => { ws.client.onClose(code, message) setImmediate(() => delete ws.client)