Skip to content

Commit

Permalink
Docs: Update context.md (#6256)
Browse files Browse the repository at this point in the history
Use token from cookies, not from ws.data
  • Loading branch information
wbjohn authored Oct 3, 2023
1 parent 0ee0426 commit 1acc819
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/guides/websocket/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Bun.serve<WebSocketData>({
// use a library to parse cookies
const cookies = parseCookies(req.headers.get("Cookie"));
const token = cookies["X-Token"];
const user = await getUserFromToken(ws.data.authToken);
const user = await getUserFromToken(token);

const upgraded = server.upgrade(req, {
data: {
Expand Down

0 comments on commit 1acc819

Please sign in to comment.