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
//! WebSocket client for real-time updates.
//!
//! This module provides a typed WebSocket client for receiving real-time
//! updates from warframe.market.
//!
//! # Feature Flag
//!
//! This module is only available with the `websocket` feature enabled:
//!
//! ```toml
//! [dependencies]
//! wf-market = { version = "0.2", features = ["websocket"] }
//! ```
//!
//! # Example
//!
//! ```ignore
//! use wf_market::{Client, Credentials};
//! use wf_market::ws::{WsEvent, Subscription};
//!
//! async fn example() -> wf_market::Result<()> {
//! let client = Client::from_credentials(/* ... */).await?;
//!
//! let ws = client.websocket()
//! .on_event(|event| async move {
//! match event {
//! WsEvent::Connected => println!("Connected!"),
//! WsEvent::OnlineCount { authorized, .. } => {
//! println!("Users online: {}", authorized);
//! }
//! WsEvent::OrderCreated { order } => {
//! println!("New order: {}p", order.platinum);
//! }
//! _ => {}
//! }
//! })
//! .subscribe(Subscription::all_new_orders())
//! .connect()
//! .await?;
//!
//! Ok(())
//! }
//! # fn main() {}
//! ```
pub use WebSocketBuilder;
pub use WebSocket;
pub use ;
pub use Subscription;
/// WebSocket server URL.
pub const WS_URL: &str = "wss://ws.warframe.market/socket";
/// WebSocket sub-protocol.
pub const WS_PROTOCOL: &str = "wfm";