ess-demux

This commit is contained in:
41666 2023-07-08 23:31:18 -04:00
parent 9ebeeb47f4
commit 5fa05ac73f
9 changed files with 1498 additions and 596 deletions

View file

@ -315,7 +315,13 @@ async fn main() {
println!("[ws] Connecting to {}", url);
let (tx, rx) = futures::channel::mpsc::unbounded();
let (ws_stream, _) = connect_async(url).await.expect("Failed to connect");
let ws_stream = match connect_async(url).await {
Ok((ws_stream, _)) => ws_stream,
Err(e) => {
println!("Error: {}", e);
return;
}
};
let (write, read) = ws_stream.split();
let fused_writer = rx.map(Ok).forward(write).fuse();