Next.js Discord

Discord Forum

WebSocket with Cookie

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
I am building casino project using Next and Express.
For chat and game I used socket.io.
But when I try to send sessionID on socket connection it doesn't work.
It worked well on the local.
It doesn't work after I deployed.
Anyone could help me to send cookie on socket please?

2 Replies

Cape lionOP
import io from "socket.io-client";

const socket = io("https://my-backend-domain.com/", {
withCredentials: true,
});
this is my approach