LibWebSocket: Add enum definition for status 1005 "no status received"

Just for a little less use of magic numbers.
This commit is contained in:
Shannon Booth
2026-03-09 16:10:40 +01:00
committed by Shannon Booth
parent fce09498f6
commit a1a9ff6bf5
Notes: github-actions[bot] 2026-03-13 16:29:29 +00:00

View File

@@ -28,6 +28,7 @@ enum class CloseStatusCode : u16 {
GoingAway = 1001,
ProtocolError = 1002,
UnsupportedData = 1003,
NoStatusReceived = 1005,
AbnormalClosure = 1006,
InvalidPayload = 1007,
PolicyViolation = 1008,
@@ -55,7 +56,7 @@ public:
void send(Message const&);
// This can only be used if the `ready_state` is `ReadyState::Open`
void close(u16 code = 1005, ByteString const& reason = {});
void close(u16 code = to_underlying(CloseStatusCode::NoStatusReceived), ByteString const& reason = {});
Function<void()> on_open;
Function<void(u16 code, ByteString reason, bool was_clean)> on_close;
@@ -127,7 +128,7 @@ private:
bool m_discard_connection_requested { false };
u16 m_last_close_code { 1005 };
u16 m_last_close_code { to_underlying(CloseStatusCode::NoStatusReceived) };
ByteString m_last_close_message;
ConnectionInfo m_connection;