node.js – How to get an httponly cookie from the browser, on the server end, with websockets in node js – Stack Overflow

I’m making a project in Node.js/Expressand want to implement websockets for a chat feature for it. I don’t yet know whether to use the ws library or socket.io library for the websocket connection.

I want to be able to: On the server side, receive the data sent from any clients, with the JWTs from that client, which would be stored in an HTTP-only cookie. I know with standard HTTP requests you could use cookie_parser() and go req.cookies.token and get it but I’m not sure how you achieve the same with websockets.

Thanks

Note: I’m happy to provide code snippets if needed

Read more here: Source link