pub struct WebSocketMessage {
pub event: String,
pub data: Option<Value>,
pub channel: Option<String>,
pub symbol: Option<String>,
pub id: Option<String>,
}Expand description
WebSocket message wrapper (incoming messages)
Fields§
§event: StringEvent type (e.g., “data”, “subscribed”, “error”, “authenticated”, “pong”)
data: Option<Value>Message data (varies by event type)
channel: Option<String>Channel (for data events)
symbol: Option<String>Symbol (for data events)
id: Option<String>Subscription ID (for subscribed events)
Implementations§
Source§impl WebSocketMessage
impl WebSocketMessage
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Check if this is an authentication success message
Sourcepub fn is_pong(&self) -> bool
pub fn is_pong(&self) -> bool
Check if this is a pong message. With the activity-timer health check
the SDK never sends internal pings, so any pong arriving on this
connection is a response to a user-initiated ping(state) and is
forwarded to user message callbacks unchanged.
Sourcepub fn is_heartbeat(&self) -> bool
pub fn is_heartbeat(&self) -> bool
Check if this is a server-initiated heartbeat ({"event":"heartbeat"}).
Heartbeats arrive every ~30 seconds and carry a microsecond timestamp
in data.time. They are forwarded to user message callbacks so callers
can use them for latency measurement or clock alignment.
Sourcepub fn is_subscribed(&self) -> bool
pub fn is_subscribed(&self) -> bool
Check if this is a subscribed confirmation
Sourcepub fn error_message(&self) -> Option<String>
pub fn error_message(&self) -> Option<String>
Get error message if this is an error
Trait Implementations§
Source§impl Clone for WebSocketMessage
impl Clone for WebSocketMessage
Source§fn clone(&self) -> WebSocketMessage
fn clone(&self) -> WebSocketMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more