forked from boostorg/beast
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
[/
|
|
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
]
|
|
|
|
[section Send and Receive Messages]
|
|
|
|
After the WebSocket handshake is accomplished, callers may send and receive
|
|
messages using the message oriented interface. This interface requires that
|
|
all of the buffers representing the message are known ahead of time:
|
|
|
|
[ws_snippet_15]
|
|
|
|
[important
|
|
Calls to [link beast.ref.beast__websocket__stream.set_option `set_option`]
|
|
must be made from the same implicit or explicit strand as that used
|
|
to perform other operations.
|
|
]
|
|
|
|
[heading Frames]
|
|
|
|
Some use-cases make it impractical or impossible to buffer the entire
|
|
message ahead of time:
|
|
|
|
* Streaming multimedia to an endpoint.
|
|
* Sending a message that does not fit in memory at once.
|
|
* Providing incremental results as they become available.
|
|
|
|
For these cases, the frame oriented interface may be used. This
|
|
example reads and echoes a complete message using this interface:
|
|
|
|
[ws_snippet_16]
|
|
|
|
[endsect]
|