Skip to content

Older clients stop working with 4.3.0 #4158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Nibbler999 opened this issue Nov 5, 2021 · 1 comment
Closed

Older clients stop working with 4.3.0 #4158

Nibbler999 opened this issue Nov 5, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Nibbler999
Copy link
Contributor

Describe the bug
Old clients get disconnected with "parse error" as the reason

To Reproduce

Socket.IO server version: 4.3.1

Server

import { Server } from "socket.io";

const io = new Server(3000, {
    allowEIO3: true,
    cors: {
        origin: ['null'],
        credentials: true
    }
});

io.on("connection", (socket) => {

  console.log(`connect ${socket.id}`);

  socket.on("data", (data) => {
      console.log(data);
  });

  socket.on("disconnect", (reason) => {
      console.log(`disconnect ${socket.id} - ${reason}`);
  });
});

Socket.IO client version: 2.3.1

Client

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="https://cdn.socket.io/socket.io-2.3.1.js"></script>
</head>
<body>
<script>

const socket = io("http://localhost:3000/", { transports: ['polling'] });

socket.on("connect", () => {
    console.log(`connect ${socket.id}`);
    socket.emit('data', "Hello!");
    socket.emit('data', new Uint8Array([1,2,3]).buffer);
});

socket.on("disconnect", () => {
    console.log("disconnect");
});

</script>
</body>

</html>

Expected behavior
Server gets the message "Hello!" and the binary message 1,2,3

Platform:
Browser

Additional context
Old client protocol
Polling transport
Multiple messages in one packet, at least one of which is binary
Server version 4.2.0 works ok

@Nibbler999 Nibbler999 added the bug Something isn't working label Nov 5, 2021
darrachequesne added a commit to socketio/engine.io that referenced this issue Nov 6, 2021
The v3 parser (used for compatibility with older clients) was broken
during the migration to TypeScript ([1]).

This was not caught in the test suite because the Node.js client does
not support binary packet in polling mode (packets are base64-encoded).

[1]: c0d6eaa

Related: socketio/socket.io#4158
@darrachequesne
Copy link
Member

I could indeed reproduce. This should be fixed in [email protected] (socketio/engine.io@3f42262), sorry for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants