react-use-websocket
react-use-websocket copied to clipboard
update to Socket.IO v4.x
Using last version of socket.io 4.x cause exception in browser:
create-or-join.ts:63 WebSocket connection to 'ws://localhost:3003/socket.io/?EIO=3&transport=websocket' failed: Invalid frame header
Which is usually means socket server/client version mismatch.
To workaround need to downgrade server library to
"socket.io": "3.1.2",
On the server side, you should include allowEIO3
in your socketIO options.
For example:
const io = new Server({
allowEIO3: true,
});
This will fix the headers.