Compare commits
1 Commits
fe87b3fb97
...
1693ab505f
Author | SHA1 | Date |
---|---|---|
kozabrada123 | 1693ab505f |
|
@ -7,38 +7,16 @@ use chorus_macros::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Received on gateway init, tells the client how often to send heartbeats;
|
/// Received on gateway init, tells the client how often to send heartbeats;
|
||||||
#[derive(
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent, Copy, Hash, PartialOrd, Ord)]
|
||||||
Debug, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent, Copy, Hash, PartialOrd, Ord,
|
|
||||||
)]
|
|
||||||
pub struct GatewayHello {
|
pub struct GatewayHello {
|
||||||
pub op: i32,
|
pub op: i32,
|
||||||
pub d: HelloData,
|
pub d: HelloData,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, Copy, WebSocketEvent, Hash, PartialOrd, Ord)]
|
||||||
Debug, Deserialize, Serialize, Clone, PartialEq, Eq, Copy, WebSocketEvent, Hash, PartialOrd, Ord,
|
|
||||||
)]
|
|
||||||
/// Contains info on how often the client should send heartbeats to the server;
|
/// Contains info on how often the client should send heartbeats to the server;
|
||||||
pub struct HelloData {
|
pub struct HelloData {
|
||||||
/// How often a client should send heartbeats, in milliseconds
|
/// How often a client should send heartbeats, in milliseconds
|
||||||
pub heartbeat_interval: u64,
|
pub heartbeat_interval: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::default::Default for GatewayHello {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
// "HELLO" opcode is 10
|
|
||||||
op: 10,
|
|
||||||
d: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::default::Default for HelloData {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
// Discord docs mention 45000 seconds - discord.sex mentions 41250. Defaulting to 45s
|
|
||||||
heartbeat_interval: 45000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue