Skip to content

Commit

Permalink
docs(node): check upgrade === "websocket" in example (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Feb 10, 2025
1 parent c340e31 commit 68264fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/2.adapters/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const server = createServer((req, res) => {
);
}).listen(3000);

server.on("upgrade", ws.handleUpgrade);
server.on("upgrade", (req, socket, head) => {
if (req.headers.upgrade === "websocket") {
ws.handleUpgrade(req, socket, head);
}
});
```

::read-more
Expand Down

0 comments on commit 68264fd

Please sign in to comment.