Skip to main content

bybit/models/
pong_data.rs

1use crate::prelude::*;
2
3/// Data structure for WebSocket pong responses.
4///
5/// Contains details of a pong response, including connection status and request metadata. Bots use this to confirm WebSocket connection health and manage reconnection logic.
6#[derive(Debug, Serialize, Deserialize, Clone)]
7pub struct PongData {
8    /// The return code for the pong response (optional).
9    ///
10    /// Indicates the status of the pong response (e.g., `0` for success). Bots should check this to verify connection health.
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub ret_code: Option<i32>,
13
14    /// Whether the pong response was successful (optional).
15    ///
16    /// If `true`, the WebSocket connection is healthy. Bots use this to confirm successful ping-pong cycles.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub success: Option<bool>,
19
20    /// A message describing the pong response.
21    ///
22    /// Typically `"pong"` or an error message. Bots should log this for debugging connection issues.
23    pub ret_msg: String,
24
25    /// The WebSocket connection ID.
26    ///
27    /// A unique identifier for the WebSocket connection. Bots use this to track specific connections in multi-connection setups.
28    pub conn_id: String,
29
30    /// The request ID for the ping (optional).
31    ///
32    /// The ID of the ping request that triggered this pong. Bots use this to correlate ping-pong pairs.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub req_id: Option<String>,
35
36    /// Additional arguments for the pong response (optional).
37    ///
38    /// Contains any additional data included in the pong, typically empty. Bots can ignore this unless handling custom WebSocket protocols.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub args: Option<Vec<String>>,
41
42    /// Additional data for the pong response (optional).
43    ///
44    /// Contains any extra data included in the pong, typically empty. Bots can ignore this unless handling custom WebSocket protocols.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub data: Option<Vec<String>>,
47
48    /// The operation type (e.g., "pong").
49    ///
50    /// Specifies the WebSocket operation, typically `"pong"`. Bots use this to confirm the response type.
51    pub op: String,
52}