hopefully close rtc connection on ws gateway close

This commit is contained in:
hippoz 2021-05-21 02:53:54 +03:00
parent dffba219d6
commit 4cd8e22a78
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -69,6 +69,9 @@ class GatewayServer extends EventEmitter {
ws.on("pong", () => { ws.on("pong", () => {
ws.alive = true; ws.alive = true;
}); });
ws.on("close", async () => {
if (ws.rtc) await ws.rtc.close();
});
ws.on("message", async (data) => { ws.on("message", async (data) => {
try { try {
const message = parseMessage(data); const message = parseMessage(data);