| Home | Libraries | People | FAQ | More

###### websocket::stream::write (2 of 2 overloads)

Write a complete message.

<h7> Synopsis </h7>

    template<
        class ConstBufferSequence>
    std::size_t
    write(
        ConstBufferSequence const& buffers,
        error_code& ec);

<h7> Description </h7>

This function is used to write a complete message. The call blocks until one of the following is true:

- The complete message is written.
- An error occurs.

The algorithm, known as a composed operation, is implemented in terms of calls to the next layer's `write_some` function. The current setting of the `websocket::stream::binary` option controls whether the message opcode is set to text or binary. If the `websocket::stream::auto_fragment` option is set, the message will be split into one or more frames as necessary. The actual payload contents sent may be transformed as per the WebSocket protocol settings.

<h7> Parameters </h7>

Name | Description
--- | ---
`buffers` | The buffers containing the message to send.
`ec` | Set to indicate what error occurred, if any.

<h7> Return Value </h7>

The number of bytes sent from the buffers.