...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Send a WebSocket close frame.
void close( close_reason const& cr, error_code& ec);
This function is used to synchronously send a close frame on the stream. The call blocks until one of the following is true:
This function is implemented in terms of one or more calls to the next
layer's write_some
functions.
If the close reason specifies a close code other than beast::websocket::close_code::none, the close frame is sent with the close code and optional reason string. Otherwise, the close frame is sent with no payload.
Callers should not attempt to write WebSocket data after initiating the
close. Instead, callers should continue reading until an error occurs.
A read returning websocket::closed
indicates a successful
connection closure.
Name |
Description |
---|---|
|
The reason for the close. |
|
Set to indicate what error occurred, if any. |