Skip to content

Commit 38b900d

Browse files
committed
Fix extra byte in websocket binary frame on EIO v3
In v3 of the engine.io protocol, the packet type byte is prepended to the binary data that is sent out on a websocket binary frame. This byte needs to be stripped off the data before it's sent to the handler. Closes #277.
1 parent c8bbd22 commit 38b900d

File tree

1 file changed

+5
-1
lines changed
  • engineioxide/src/transport

1 file changed

+5
-1
lines changed

engineioxide/src/transport/ws.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ where
182182
}
183183
p => return Err(Error::BadPacket(p)),
184184
},
185-
Message::Binary(data) => {
185+
Message::Binary(mut data) => {
186+
if socket.protocol == ProtocolVersion::V3 && !data.is_empty() {
187+
// The first byte is the message type, which we don't need.
188+
let _ = data.remove(0);
189+
}
186190
engine.handler.on_binary(data, socket.clone());
187191
Ok(())
188192
}

0 commit comments

Comments
 (0)