Beast Logo

PrevUpHomeNext

websocket::message_type

Message type option.

using message_type = implementation-defined;

This controls the opcode set for outgoing messages. Valid choices are opcode::binary or opcode::text. The setting is only applied at the start when a caller begins a new message. Changing the opcode after a message is started will only take effect after the current message being sent is complete.

The default setting is opcode::text.

Remarks

Objects of this type are used with beast::websocket::stream::set_option.

Example

Setting the message type to binary.

...
websocket::stream<ip::tcp::socket> ws(ios);
ws.set_option(message_type{opcode::binary});
Requirements

Header: beast/websocket/option.hpp

Convenience header: beast/websocket.hpp


PrevUpHomeNext