mirror of
https://github.com/celisej567/abaddon.git
synced 2026-01-05 18:09:48 +03:00
HeartbeatMessage now uses yyjson
This commit is contained in:
@@ -2658,8 +2658,8 @@ void DiscordClient::HeartbeatThread() {
|
|||||||
|
|
||||||
HeartbeatMessage msg;
|
HeartbeatMessage msg;
|
||||||
msg.Sequence = m_last_sequence;
|
msg.Sequence = m_last_sequence;
|
||||||
nlohmann::json j = msg;
|
//nlohmann::json j = msg;
|
||||||
m_websocket.Send(j);
|
m_websocket.Send(msg.BuildJson());
|
||||||
|
|
||||||
if (!m_heartbeat_waiter.wait_for(std::chrono::milliseconds(m_heartbeat_msec)))
|
if (!m_heartbeat_waiter.wait_for(std::chrono::milliseconds(m_heartbeat_msec)))
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -517,6 +517,19 @@ struct IdentifyMessage : GatewayMessage {
|
|||||||
struct HeartbeatMessage : GatewayMessage {
|
struct HeartbeatMessage : GatewayMessage {
|
||||||
int Sequence;
|
int Sequence;
|
||||||
|
|
||||||
|
std::string BuildJson() const
|
||||||
|
{
|
||||||
|
YYJsonDocument yyjsn;
|
||||||
|
yyjsn.CreateDoc();
|
||||||
|
yyjsn.AddInt("op", (int)GatewayOp::Heartbeat);
|
||||||
|
if (Sequence == -1)
|
||||||
|
yyjsn.AddNull("d");
|
||||||
|
else
|
||||||
|
yyjsn.AddInt("d", Sequence);
|
||||||
|
|
||||||
|
return yyjsn.BuildJson();
|
||||||
|
}
|
||||||
|
|
||||||
friend void to_json(nlohmann::json &j, const HeartbeatMessage &m);
|
friend void to_json(nlohmann::json &j, const HeartbeatMessage &m);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user