Remove unneded let _ = in websocket example
This commit is contained in:
parent
f37d068af5
commit
06ece6a8c3
1 changed files with 6 additions and 10 deletions
|
|
@ -22,9 +22,7 @@ pub fn connect() -> impl Sipper<Never, Event> {
|
||||||
Ok((websocket, _)) => {
|
Ok((websocket, _)) => {
|
||||||
let (sender, receiver) = mpsc::channel(100);
|
let (sender, receiver) = mpsc::channel(100);
|
||||||
|
|
||||||
let _ = output
|
output.send(Event::Connected(Connection(sender))).await;
|
||||||
.send(Event::Connected(Connection(sender)))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
(websocket.fuse(), receiver)
|
(websocket.fuse(), receiver)
|
||||||
}
|
}
|
||||||
|
|
@ -32,8 +30,7 @@ pub fn connect() -> impl Sipper<Never, Event> {
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(1))
|
tokio::time::sleep(tokio::time::Duration::from_secs(1))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let _ = output.send(Event::Disconnected).await;
|
output.send(Event::Disconnected).await;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -43,21 +40,20 @@ pub fn connect() -> impl Sipper<Never, Event> {
|
||||||
received = websocket.select_next_some() => {
|
received = websocket.select_next_some() => {
|
||||||
match received {
|
match received {
|
||||||
Ok(tungstenite::Message::Text(message)) => {
|
Ok(tungstenite::Message::Text(message)) => {
|
||||||
let _ = output.send(Event::MessageReceived(Message::User(message))).await;
|
output.send(Event::MessageReceived(Message::User(message))).await;
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let _ = output.send(Event::Disconnected).await;
|
output.send(Event::Disconnected).await;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Ok(_) => continue,
|
Ok(_) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message = input.select_next_some() => {
|
message = input.select_next_some() => {
|
||||||
let result = websocket.send(tungstenite::Message::Text(message.to_string())).await;
|
let result = websocket.send(tungstenite::Message::Text(message.to_string())).await;
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
let _ = output.send(Event::Disconnected).await;
|
output.send(Event::Disconnected).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue