...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Provides message-oriented functionality using WebSocket.
Defined in header <boost/beast/websocket/stream_fwd.hpp>
template< class NextLayer, bool deflateSupported> class stream
Name |
Description |
---|---|
The type of the executor associated with the object. |
|
Indicates if the permessage-deflate extension is supported. |
|
The type of the next layer. |
Name |
Description |
---|---|
Perform the WebSocket handshake in the server role. |
|
Perform the WebSocket handshake asynchronously in the server role. |
|
Send a websocket close control frame asynchronously. |
|
Perform the WebSocket handshake asynchronously in the client role. |
|
Send a websocket ping control frame asynchronously. |
|
Send a websocket pong control frame asynchronously. |
|
Read a complete message asynchronously. |
|
Read some message data asynchronously. |
|
Write a complete message asynchronously. |
|
Write some message data asynchronously. |
|
Set the automatic fragmentation option. |
|
Set the binary message write option. |
|
Send a websocket close control frame. |
|
Set a callback to be invoked on each incoming control frame. |
|
Get the executor associated with the object. |
|
|
|
Returns |
|
Returns |
|
Perform the WebSocket handshake in the client role. |
|
Returns |
|
Returns |
|
Get a reference to the next layer. |
|
Move assignment (deleted) |
|
Send a websocket ping control frame. |
|
Send a websocket pong control frame. |
|
Read a complete message. |
|
Set the maximum incoming message size option. |
|
Returns a suggested maximum buffer size for the next call to read. |
|
Read some message data. |
|
Returns the close reason received from the remote peer. |
|
Set whether the PRNG is cryptographically secure. |
|
|
|
stream [constructor] |
Constructor. |
Set the text message write option. |
|
Write a complete message. |
|
Set the write buffer size option. |
|
Write some message data. |
|
~stream [destructor] |
Destructor. |
The stream
class template provides asynchronous
and blocking message-oriented functionality necessary for clients and servers
to utilize the WebSocket protocol. For asynchronous operations, the application
must ensure that they are are all performed within the same implicit or explicit
strand.
Distinctobjects:Safe.
Sharedobjects:Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
To declare the stream
object with a tcp_stream
in a multi-threaded asynchronous
program using a strand, you may write:
websocket::stream<tcp_stream> ws{net::make_strand(ioc)};
Alternatively, for a single-threaded or synchronous application you may write:
websocket::stream<tcp_stream> ws(ioc);
Type |
Description |
---|---|
|
The type representing the next layer, to which data will be read and written during operations. For synchronous operations, the type must support the SyncStream concept. For asynchronous operations, the type must support the AsyncStream concept. |
|
A |
A stream object must not be moved or destroyed while there are pending asynchronous operations associated with it.