...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Perform the WebSocket closing handshake and close the underlying stream.
void close( close_reason const& cr, error_code& ec);
This function sends a close
frame to begin the WebSocket closing handshake and waits for
a corresponding close frame in response. Once received, it calls teardown
to gracefully shut down the underlying stream.
After beginning the closing handshake, the program should not write further
message data, pings, or pongs. However, it can still read incoming message
data. A read returning error::closed
indicates a successful
connection closure.
The call blocks until one of the following conditions is true:
teardown
finishes.
The algorithm, known as a composed operation, is
implemented in terms of calls to the next layer's write_some
function.
Name |
Description |
---|---|
|
The reason for the close. If the close reason specifies a close
code other than |
|
Set to indicate what error occurred, if any. |