WIP
This commit is contained in:
@@ -6,3 +6,5 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
tokio = "*"
|
||||
websockets = "0.3.0"
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use websockets::{WebSocket, WebSocketError};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), 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);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user