Represents a buffer for a single WebSocket message. More...
#include <message.hpp>
Public Types | |
typedef lib::shared_ptr< message > | ptr |
typedef con_msg_manager< message > | con_msg_man_type |
typedef con_msg_man_type::ptr | con_msg_man_ptr |
typedef con_msg_man_type::weak_ptr | con_msg_man_weak_ptr |
typedef lib::shared_ptr< message > | ptr |
typedef con_msg_manager::weak_ptr | con_msg_man_ptr |
Public Member Functions | |
message (const con_msg_man_ptr manager) | |
Construct an empty message. More... | |
message (const con_msg_man_ptr manager, frame::opcode::value op, size_t size=128) | |
Construct a message and fill in some values. More... | |
bool | get_prepared () const |
Return whether or not the message has been prepared for sending. More... | |
void | set_prepared (bool value) |
Set or clear the flag that indicates that the message has been prepared. More... | |
bool | get_compressed () const |
Return whether or not the message is flagged as compressed. More... | |
void | set_compressed (bool value) |
Set or clear the compression flag. More... | |
bool | get_terminal () const |
Get whether or not the message is terminal. More... | |
void | set_terminal (bool value) |
Set the terminal flag. More... | |
bool | get_fin () const |
Read the fin bit. More... | |
void | set_fin (bool value) |
Set the fin bit. More... | |
frame::opcode::value | get_opcode () const |
Return the message opcode. More... | |
void | set_opcode (frame::opcode::value op) |
Set the opcode. More... | |
std::string const & | get_header () const |
Return the prepared frame header. More... | |
void | set_header (std::string const &header) |
Set prepared frame header. More... | |
std::string const & | get_extension_data () const |
std::string const & | get_payload () const |
Get a reference to the payload string. More... | |
std::string & | get_raw_payload () |
Get a non-const reference to the payload string. More... | |
void | set_payload (std::string const &payload) |
Set payload data. More... | |
void | set_payload (void const *payload, size_t len) |
Set payload data. More... | |
void | append_payload (std::string const &payload) |
Append payload data. More... | |
void | append_payload (void const *payload, size_t len) |
Append payload data. More... | |
bool | recycle () |
Recycle the message. More... | |
message (con_msg_man_ptr manager, size_t size=128) | |
frame::opcode::value | get_opcode () const |
const std::string & | get_header () const |
const std::string & | get_extension_data () const |
const std::string & | get_payload () const |
bool | recycle () |
Recycle the message. More... | |
Represents a buffer for a single WebSocket message.
Definition at line 84 of file message.hpp.
typedef lib::shared_ptr<message> websocketpp::message_buffer::message< con_msg_manager >::ptr |
Definition at line 86 of file message.hpp.
typedef con_msg_manager<message> websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_type |
Definition at line 88 of file message.hpp.
typedef con_msg_man_type::ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_ptr |
Definition at line 89 of file message.hpp.
typedef con_msg_man_type::weak_ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_weak_ptr |
Definition at line 90 of file message.hpp.
typedef lib::shared_ptr<message> websocketpp::message_buffer::message< con_msg_manager >::ptr |
typedef con_msg_manager::weak_ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_ptr |
|
inline |
|
inline |
Construct a message and fill in some values.
Definition at line 107 of file message.hpp.
References nonstd::span_lite::size().
|
inline |
|
inline |
Return whether or not the message has been prepared for sending.
The prepared flag indicates that the message has been prepared by a websocket protocol processor and is ready to be written to the wire.
Definition at line 125 of file message.hpp.
|
inline |
Set or clear the flag that indicates that the message has been prepared.
This flag should not be set by end user code without a very good reason.
value | The value to set the prepared flag to |
Definition at line 135 of file message.hpp.
|
inline |
Return whether or not the message is flagged as compressed.
Definition at line 143 of file message.hpp.
|
inline |
Set or clear the compression flag.
Setting the compression flag indicates that the data in this message would benefit from compression. If both endpoints negotiate a compression extension WebSocket++ will attempt to compress messages with this flag. Setting this flag does not guarantee that the message will be compressed.
value | The value to set the compressed flag to |
Definition at line 156 of file message.hpp.
|
inline |
Get whether or not the message is terminal.
Messages can be flagged as terminal, which results in the connection being close after they are written rather than the implementation going on to the next message in the queue. This is typically used internally for close messages only.
Definition at line 169 of file message.hpp.
|
inline |
Set the terminal flag.
This flag should not be set by end user code without a very good reason.
value | The value to set the terminal flag to. |
Definition at line 181 of file message.hpp.
|
inline |
Read the fin bit.
A message with the fin bit set will be sent as the last message of its sequence. A message with the fin bit cleared will require subsequent frames of opcode continuation until one of them has the fin bit set.
The remote end likely will not deliver any bytes until the frame with the fin bit set has been received.
Definition at line 195 of file message.hpp.
|
inline |
Set the fin bit.
value | The value to set the fin bit to. |
Definition at line 205 of file message.hpp.
|
inline |
Return the message opcode.
Definition at line 210 of file message.hpp.
|
inline |
Set the opcode.
Definition at line 215 of file message.hpp.
|
inline |
Return the prepared frame header.
This value is typically set by a websocket protocol processor and shouldn't be tampered with.
Definition at line 224 of file message.hpp.
|
inline |
Set prepared frame header.
Under normal circumstances this should not be called by end users
header | A string to set the header to. |
Definition at line 234 of file message.hpp.
|
inline |
Definition at line 238 of file message.hpp.
|
inline |
Get a reference to the payload string.
Definition at line 246 of file message.hpp.
|
inline |
Get a non-const reference to the payload string.
Definition at line 254 of file message.hpp.
|
inline |
Set payload data.
Set the message buffer's payload to the given value.
payload | A string to set the payload to. |
Definition at line 264 of file message.hpp.
|
inline |
Set payload data.
Set the message buffer's payload to the given value.
payload | A pointer to a data array to set to. |
len | The length of new payload in bytes. |
Definition at line 275 of file message.hpp.
|
inline |
Append payload data.
Append data to the message buffer's payload.
payload | A string containing the data array to append. |
Definition at line 287 of file message.hpp.
|
inline |
Append payload data.
Append data to the message buffer's payload.
payload | A pointer to a data array to append |
len | The length of payload in bytes |
Definition at line 298 of file message.hpp.
|
inline |
Recycle the message.
A request to recycle this message was received. Forward that request to the connection message manager for processing. Errors and exceptions from the manager's recycle member function should be passed back up the call chain. The caller to message::recycle will deal with them.
Recycle must only be called by the message shared_ptr's destructor. Once recycled successfully, ownership of the memory has been passed to another system and must not be accessed again.
Definition at line 316 of file message.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Recycle the message.
A request to recycle this message was received. Forward that request to the connection message manager for processing. Errors and exceptions from the manager's recycle member function should be passed back up the call chain. The caller to message::recycle will deal with them.
Recycle must only be called by the message shared_ptr's destructor. Once recycled successfully, ownership of the memory has been passed to another system and must not be accessed again.