Skip to content

Commit

Permalink
feat(websocket): 采用长连接处理翻译问题
Browse files Browse the repository at this point in the history
  • Loading branch information
vacuityv committed Aug 17, 2023
1 parent 74c5bbc commit 94c9074
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -179,6 +182,7 @@ function initWebsocket() {
interval: 10,
repeats: true,
handler: function () {
websocket.ping()
count += 1;
$log.info(`count=${count}`)
// 空闲 10*60s 后关闭
Expand Down

0 comments on commit 94c9074

Please sign in to comment.