28 #ifndef WEBSOCKETPP_MESSAGE_BUFFER_MESSAGE_HPP 29 #define WEBSOCKETPP_MESSAGE_BUFFER_MESSAGE_HPP 37 namespace message_buffer {
83 template <
template<
class>
class con_msg_manager>
86 typedef lib::shared_ptr<message>
ptr;
101 , m_compressed(false) {}
113 , m_compressed(false)
115 m_payload.reserve(size);
157 m_compressed =
value;
239 return m_extension_data;
276 m_payload.reserve(len);
277 char const * pl =
static_cast<char const *
>(payload);
278 m_payload.assign(pl, pl + len);
288 m_payload.append(payload);
299 m_payload.reserve(m_payload.size()+len);
300 m_payload.append(static_cast<char const *>(payload),len);
317 con_msg_man_ptr shared = m_manager.lock();
320 return shared->recycle(
this);
326 con_msg_man_weak_ptr m_manager;
327 std::string m_header;
328 std::string m_extension_data;
329 std::string m_payload;
340 #endif // WEBSOCKETPP_MESSAGE_BUFFER_MESSAGE_HPP std::string const & get_extension_data() const
con_msg_manager< message > con_msg_man_type
con_msg_man_type::ptr con_msg_man_ptr
void set_terminal(bool value)
Set the terminal flag.
void set_fin(bool value)
Set the fin bit.
message(const con_msg_man_ptr manager)
Construct an empty message.
std::string const & get_payload() const
Get a reference to the payload string.
void set_opcode(frame::opcode::value op)
Set the opcode.
con_msg_man_type::weak_ptr con_msg_man_weak_ptr
lib::shared_ptr< message > ptr
std::string & get_raw_payload()
Get a non-const reference to the payload string.
frame::opcode::value get_opcode() const
Return the message opcode.
void append_payload(std::string const &payload)
Append payload data.
message(const con_msg_man_ptr manager, frame::opcode::value op, size_t size=128)
Construct a message and fill in some values.
void set_header(std::string const &header)
Set prepared frame header.
Namespace for the WebSocket++ project.
void set_compressed(bool value)
Set or clear the compression flag.
Represents a buffer for a single WebSocket message.
void append_payload(void const *payload, size_t len)
Append payload data.
bool get_compressed() const
Return whether or not the message is flagged as compressed.
bool get_prepared() const
Return whether or not the message has been prepared for sending.
bool get_fin() const
Read the fin bit.
void set_prepared(bool value)
Set or clear the flag that indicates that the message has been prepared.
std::string const & get_header() const
Return the prepared frame header.
bool recycle()
Recycle the message.
void set_payload(void const *payload, size_t len)
Set payload data.
void set_payload(std::string const &payload)
Set payload data.
bool get_terminal() const
Get whether or not the message is terminal.