From 4cd8e22a786efa05fdb9b0abe25bd642d0ac45de Mon Sep 17 00:00:00 2001 From: hippoz Date: Fri, 21 May 2021 02:53:54 +0300 Subject: [PATCH] hopefully close rtc connection on ws gateway close --- brainlet/api/v2/gateway/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brainlet/api/v2/gateway/index.js b/brainlet/api/v2/gateway/index.js index 9005751..611e241 100644 --- a/brainlet/api/v2/gateway/index.js +++ b/brainlet/api/v2/gateway/index.js @@ -69,6 +69,9 @@ class GatewayServer extends EventEmitter { ws.on("pong", () => { ws.alive = true; }); + ws.on("close", async () => { + if (ws.rtc) await ws.rtc.close(); + }); ws.on("message", async (data) => { try { const message = parseMessage(data);