This commit is contained in:
Dave Hrycyszyn
2024-05-29 12:44:52 +01:00
parent c4ad5365a2
commit 6d39f52532
5 changed files with 1357 additions and 3 deletions

View File

@@ -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(())
}