This reproduces an issue where socketioxide, when acting as a v4 server,
fails to receive binary events properly. The Vec<u8>
passed to the
handler contains the correct binary data, but it is prefixed with a
0x4
byte.
- Prerequisites:
- A cargo/rust compiler environment
- JDK 11 or greater, and maven
- In one terminal, run
make run-server
- In another terminal, run
make run-client
- Assuming both have compiled and run successfully, switch back to the first terminal and watch for output.
We see:
Got binary data: [4, 98, 105, 110, 97, 114, 121]
But we should see:
Got binary data: [98, 105, 110, 97, 114, 121]
When socketioxide acts as a v5 server (change the version of the Java
socketio client in client/pom.xml
to 2.1.0), socketioxide receives
binary frames as expected.
If the client connects using the HTTP polling transport, the issue does
not occur. (Open Main.java
and change the options.transports
line
so it only contains Polling.NAME
to see this in action.)
Other server implementations, such as the socket.io-server-java and JS socket.io 2.5.0 see the binary frames properly.