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
I was testing a case where the server shut down mid-session and my client outputted the error below (four times), but doesn't panic. There isn't an obvious place to handle the error since EngineIO Error isn't the type of any of the return values of methods I call. Is there some way to add a handler for unexpected disconnects?
Error: String(
"EngineIO Error",
)
The code below is the setup.
loop {
let (is_done, rx) = mpsc::channel();
let handler = make_response_handler(is_done);
give_prompt();
let input = get_input();
let socket = ClientBuilder::new("http://localhost:3000")
.on("search", handler)
.on("error", |err, _| eprintln!("Error: {:#?}", err))
.connect()
.expect("Connection failed");
let _result = socket
.emit("search", json!({ "query": input }))
.expect("Failed to emit");
// Block on a channel waiting for the handler to signal completion, would like to send `_is_done` on server disconnect.
let _is_done = rx.recv();
// Never gets down here because still waiting on the server which has disconnected.
println!("Made it past blocking!");
}
The text was updated successfully, but these errors were encountered:
I was testing a case where the server shut down mid-session and my client outputted the error below (four times), but doesn't panic. There isn't an obvious place to handle the error since
EngineIO Error
isn't the type of any of the return values of methods I call. Is there some way to add a handler for unexpected disconnects?The code below is the setup.
The text was updated successfully, but these errors were encountered: