| Home | Libraries | People | FAQ | More

###### websocket::stream::write_buffer_bytes (1 of 2 overloads)

Set the write buffer size option.

###### Synopsis

    void
    write_buffer_bytes(
        std::size_t amount);

###### Description

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.

###### Example

Setting the write buffer size.

    ws.write_buffer_bytes(8192);

###### Parameters

Name | Description
--- | ---
`amount` | The size of the write buffer in bytes.