socketio / socket.io-protocol

Socket.IO Protocol specification
https://socket.io
507 stars 62 forks source link

Socket.io v4 test-suite #34

Open Totodore opened 1 year ago

Totodore commented 1 year ago

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');
    });