From 94c9074e3b556e80896d070c4bd9c0f8df7ec078 Mon Sep 17 00:00:00 2001 From: vacuity Date: Thu, 17 Aug 2023 11:45:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(websocket):=20=E9=87=87=E7=94=A8=E9=95=BF?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=A4=84=E7=90=86=E7=BF=BB=E8=AF=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.js b/main.js index 4e756aa..1dc9875 100644 --- a/main.js +++ b/main.js @@ -168,6 +168,9 @@ function initWebsocket() { signal.send({"message": string}) }) }) + websocket.listenClose(function (socket, code, reason) { + $log.info(`did close: code=${code}; reason=${reason}`); + }) count = 0; @@ -179,6 +182,7 @@ function initWebsocket() { interval: 10, repeats: true, handler: function () { + websocket.ping() count += 1; $log.info(`count=${count}`) // 空闲 10*60s 后关闭