test1/test1.rs
1use rustwave::{Client, Result};
2
3#[tokio::main]
4async fn main() -> Result<()> {
5 let client = Client::connect("ws://127.0.0.1:8080/").await?;
6
7 client.on("pong", |data| async move {
8 println!("Server replied: {}", data);
9 });
10
11 client.emit("ping", "").await?;
12
13 tokio::time::sleep(std::time::Duration::from_secs(1)).await;
14
15 Ok(())
16}