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) => {