-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
Example
let socket = ClientBuilder::new("wss::server.com")
.transport_type(rust_socketio::TransportType::Websocket)
.connect()
.expect("Failed to connect"");
socket.emit("test", json!({})).expect("Failed to emit test event");Connects successfully and then sends event successfully but then the connection closes and server doesn't send back a "test" event.
My bandaid fix
let socket = ClientBuilder::new("wss::server.com")
.transport_type(rust_socketio::TransportType::Websocket)
.connect()
.expect("Failed to connect"");
std::thread::sleep(Duration::from::millis(500));
socket.emit("test", json!({})).expect("Failed to emit test event");Server now sends back a "test" event and things work as expected.
My guess is that ClientBuilder::new returns when a websocket handshake is successful but doesn't wait for the Socket.io handshake. When an emit is immediately sent it interrupts the handshake somehow and the connection gets closed. I'd expect for ClientBuilder::new to wait until a full connection is formed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels