socket.io-protocol
socket.io-protocol copied to clipboard
Socket.io v4 test-suite
Here is a PR to add a socket.io protocol v4 test suite.
Closes #30
The only thing I'm not sure is this test :
it("should disallow connection to an unknown namespace", async () => {
const socket = new WebSocket(
`${WS_URL}/socket.io/?EIO=3&transport=websocket`
);
await waitFor(socket, "message"); // Engine.IO handshake
await waitFor(socket, "message"); // Socket.IO / namespace handshake
await waitFor(socket, "message"); // auth packet
socket.send("40/random");
const { data } = await waitFor(socket, "message");
// Should I expect "Invalid namespace" or "{ "message": "Invalid namespace" }"
expect(data).to.eql('44/random,Invalid namespace');
});