#TIL 37 - How to fix Session ID unknown with socket.io
![blog_hero_#TIL 37 - How to fix Session ID unknown with socket.io](/_next/image?url=%2Fstatic%2Ftil.jpeg&w=2048&q=75)
If you're using Socket.io in your web application, you may encounter an issue where the Session ID is unknown. The solution is disabling HTTP long-polling and using only WebSockets for communication between the client and server.
// client-side
const socket = io({
transports: ["websocket"] // HTTP long-polling is disabled
});
The root cause is enabling "sticky session" if HTTP long-polling is enabled (which is the default). You can read more about why sticky sessions are required and how to implement them in the Socket.io documentation: https://socket.io/docs/v4/using-multiple-nodes/#why-is-sticky-session-required