2017-06-03 18:40:28 -07:00
|
|
|
[/
|
2017-07-28 19:32:33 -07:00
|
|
|
Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-06-03 18:40:28 -07:00
|
|
|
|
|
|
|
|
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)
|
2017-07-28 19:32:33 -07:00
|
|
|
|
|
|
|
|
Official repository: https://github.com/boostorg/beast
|
2017-06-03 18:40:28 -07:00
|
|
|
]
|
|
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section Send and Receive Messages]
|
2017-06-03 18:40:28 -07:00
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
2017-06-08 15:23:30 -07:00
|
|
|
[ws_snippet_15]
|
2017-06-03 18:40:28 -07:00
|
|
|
|
|
|
|
|
[important
|
2017-07-23 22:49:57 -07:00
|
|
|
Calls to [link beast.ref.boost__beast__websocket__stream.set_option `set_option`]
|
2017-06-03 18:40:28 -07:00
|
|
|
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:
|
2017-06-08 15:23:30 -07:00
|
|
|
|
|
|
|
|
[ws_snippet_16]
|
2017-06-03 18:40:28 -07:00
|
|
|
|
|
|
|
|
[endsect]
|