From accffb29e148b8badb56195044bebf63fcfe3b2f Mon Sep 17 00:00:00 2001 From: jrcleber Date: Tue, 9 Jul 2024 13:57:28 -0300 Subject: [PATCH] hub -> set --- src/websocket/Readme.md | 4 ++++ src/websocket/server.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/websocket/Readme.md b/src/websocket/Readme.md index a9bdda73..974b577a 100644 --- a/src/websocket/Readme.md +++ b/src/websocket/Readme.md @@ -106,4 +106,8 @@ socket("connection.update", (msg, event) => { socket("messages.upsert", (msg, event) => { console.log(msg) }) + +socket("qrcode.updated", (msg, event) => { + console.log(msg) +}) ``` \ No newline at end of file diff --git a/src/websocket/server.ts b/src/websocket/server.ts index 69e9fd53..a2a77c2e 100644 --- a/src/websocket/server.ts +++ b/src/websocket/server.ts @@ -70,9 +70,10 @@ export class Websocket { wss.on('connection', (ws, req) => { if (!canActivate) { - ws.close(401, ' HTTP/1.1 401 Unauthorized'); + ws.close(401, 'HTTP/1.1 401 Unauthorized'); return; } + this.hub.set(key, ws); }); server.on('upgrade', (req, socket, head) => {