You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if let Err(error) = connect("ws://echo.websocket.org", |out| {
// Queue a message to be sent when the WebSocket is open
if out.send("Hello WebSocket").is_err() {
println!("Websocket couldn't queue an initial message.")
} else {
println!("Client sent message 'Hello WebSocket'. ")
}
// The handler needs to take ownership of out, so we use move
move |msg| {
// Handle messages received on this connection
println!("Client got message '{}'. ", msg);
// Close the connection
out.close(CloseCode::Normal)
}
}) {
// Inform the user of failure
println!("Failed to create WebSocket due to: {:?}", error);
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: