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
//! # rifts-client — Rift Realtime Protocol / 1.0 Async Rust Client SDK
//!
//! Connect to a [`rifts`](crate) server over WebSocket,
//! perform the Hello/Welcome/Ready handshake, and interact with topics
//! through a typed, broadcast-based event system.
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use rifts::client::{RiftClient, RiftClientConfig, ClientEvent};
//! use rifts::broker::SubscribeIntent;
//!
//! # async fn run() -> rifts::client::Result<()> {
//! let client = RiftClient::new(
//! "ws://localhost:9000",
//! RiftClientConfig {
//! client_id: "my-app".into(),
//! token: "my-jwt".into(),
//! ..Default::default()
//! },
//! );
//!
//! let mut events = client.subscribe_events();
//! client.connect().await?;
//!
//! client.subscribe("room/1", SubscribeIntent::Live, None).await?;
//! client.publish(
//! "room/1", "chat.message", "chat.message@1.0",
//! serde_json::json!({"text": "hello"}),
//! None,
//! ).await?;
//!
//! while let Ok(evt) = events.recv().await {
//! match evt {
//! ClientEvent::EventReceived { topic, event } => {
//! println!("[{topic}] {}: {:?}", event.event, event.payload);
//! }
//! ClientEvent::Disconnected { .. } => break,
//! _ => {}
//! }
//! }
//! # Ok(())
//! # }
//! ```
pub
pub
pub
pub use RiftClientConfig;
pub use ;
pub use ClientEvent;
pub use ;
// Re-export commonly used types for convenience.
pub use crateSubscribeIntent;
pub use crate;
pub use crateReply;
pub use crateCloseCode;