userver: userver/websocket/message.hpp Source File
Loading...
Searching...
No Matches
message.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/websocket/message.hpp
4/// @brief @copybrief websocket::Message
5
6#include <optional>
7#include <string>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace websocket {
12
13using CloseStatusInt = int16_t;
14
15/// @brief Close statuses
17 kNone = 0,
18
19 kNormal = 1000,
20 kGoingAway = 1001,
21 kProtocolError = 1002,
22 kUnsupportedData = 1003,
23 kFrameTooLarge = 1004,
24 kNoStatusRcvd = 1005,
25 kAbnormalClosure = 1006,
26 kBadMessageData = 1007,
27 kPolicyViolation = 1008,
28 kTooBigData = 1009,
29 kExtensionMismatch = 1010,
30 kServerError = 1011
31};
32
33/// @brief WebSocket message
34struct Message {
35 std::string data; ///< payload
36 std::optional<CloseStatus> close_status = {}; ///< close status
37 bool is_text = false; ///< is it text or binary?
38};
39
40} // namespace websocket
41
42USERVER_NAMESPACE_END