1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! A [Socket.IO](https://socket.io) v4 client for Rust, with the behaviour of the reference
//! JavaScript client (socket.io-client 4.8 / engine.io-client 6.6): namespaces, auth, acks in
//! both directions, binary data anywhere in the arguments, reconnection with the same backoff,
//! connection state recovery, and polling / websocket transports over rustls or native-tls.
//!
//! ```no_run
//! use std::time::Duration;
//! use socketio_next::{Client, ClientBuilder, ConnectionState, Event};
//! use serde_json::json;
//!
//! #[tokio::main]
//! async fn main() -> socketio_next::Result<()> {
//! let client = ClientBuilder::new("http://localhost:3000")
//! .auth(json!({ "token": "abc" }))
//! .on("greeting", |event: Event, _client: Client| async move {
//! println!("server says {:?}", event.payload());
//! })
//! .on_state_change(|state: ConnectionState, _client: Client| async move {
//! println!("state: {state:?}");
//! })
//! .connect()
//! .await?;
//!
//! client.emit("hello", json!({ "from": "rust" }))?;
//! let reply = client
//! .emit_with_ack("add", vec![json!(1), json!(2)], Duration::from_secs(5))
//! .await?;
//! println!("1 + 2 = {}", reply.arg::<i64>(0)?);
//!
//! client.disconnect().await
//! }
//! ```
//!
//! - [`ClientBuilder`] configures and connects; [`Client`] emits, acks, adds handlers at
//! runtime and reports [`ConnectionState`] / [`LinkInfo`].
//! - [`blocking`] (feature `blocking`) is the same client without async.
//! - [`engineio`] is the transport layer, [`protocol`] the packet codecs (no I/O).
pub use ;
pub use Client;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Payload;
pub use ;
pub use TransportType;