Beast Logo

PrevUpHomeNext

websocket::write_buffer_size

Write buffer size option.

using write_buffer_size = implementation-defined;

Sets the size of the write buffer used by the implementation to send frames. The write buffer is needed when masking payload data in the client role, compressing frames, or auto-fragmenting message data.

Lowering the size of the buffer can decrease the memory requirements for each connection, while increasing the size of the buffer can reduce the number of calls made to the next layer to write data.

The default setting is 4096. The minimum value is 8.

The write buffer size can only be changed when the stream is not open. Undefined behavior results if the option is modified after a successful WebSocket handshake.

Remarks

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

Example

Setting the write buffer size.

...
websocket::stream<ip::tcp::socket> ws(ios);
ws.set_option(write_buffer_size{8192});
Requirements

Header: beast/websocket/option.hpp

Convenience header: beast/websocket.hpp


PrevUpHomeNext