Skip to content

Commit

Permalink
hub -> set
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Jul 9, 2024
1 parent dbdd78b commit accffb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/websocket/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
```
3 changes: 2 additions & 1 deletion src/websocket/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit accffb2

Please sign in to comment.