From e13a6eab810ebbb0574d2791682caed7acddd8ca Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 25 Jan 2021 00:47:48 -0500 Subject: handle opcode 9 invalid session and improve handling socket closure --- discord/objects.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'discord/objects.hpp') diff --git a/discord/objects.hpp b/discord/objects.hpp index 575ee85..e7e574c 100644 --- a/discord/objects.hpp +++ b/discord/objects.hpp @@ -28,6 +28,7 @@ enum class GatewayOp : int { UpdateStatus = 3, Resume = 6, Reconnect = 7, + InvalidSession = 9, Hello = 10, HeartbeatAck = 11, LazyLoadRequest = 14, @@ -62,6 +63,28 @@ enum class GatewayEvent : int { INVITE_DELETE, }; +enum class GatewayCloseCode : uint16_t { + // discord + UnknownError = 4000, + UnknownOpcode = 4001, + DecodeError = 4002, + NotAuthenticated = 4003, + AuthenticationFailed = 4004, + AlreadyAuthenticated = 4005, + InvalidSequence = 4007, + RateLimited = 4008, + SessionTimedOut = 4009, + InvalidShard = 4010, + ShardingRequired = 4011, + InvalidAPIVersion = 4012, + InvalidIntents = 4013, + DisallowedIntents = 4014, + + // internal + UserDisconnect = 4091, + Reconnecting = 4092, +}; + struct GatewayMessage { GatewayOp Opcode; nlohmann::json Data; -- cgit v1.2.3