Breaking websocket functionality out into its own module
This commit is contained in:
13
side-node/src/websocket/mod.rs
Normal file
13
side-node/src/websocket/mod.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use websockets::WebSocket;
|
||||
|
||||
pub(crate) async fn start() -> Result<(), websockets::WebSocketError> {
|
||||
let mut ws = WebSocket::connect("ws://localhost:8080/").await?;
|
||||
|
||||
ws.send_text("foo".to_string()).await?;
|
||||
// ws.receive().await?;
|
||||
// ws.close(None).await?;
|
||||
loop {
|
||||
let msg = ws.receive().await?;
|
||||
println!("Received: {:?}", msg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user