...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Respond to a WebSocket HTTP Upgrade request.
template< class Body, class Allocator> void accept( http::request< Body, http::basic_fields< Allocator >> const& req);
This function is used to synchronously send the HTTP response to an HTTP request possibly containing a WebSocket Upgrade. The call blocks until one of the following conditions is true:
This function is implemented in terms of one or more calls to the next
layer's read_some
and
write_some
functions.
If the stream receives a valid HTTP WebSocket Upgrade request, an HTTP response is sent back indicating a successful upgrade. When this call returns, the stream is then ready to send and receive WebSocket protocol frames and messages. If the HTTP Upgrade request is invalid or cannot be satisfied, an HTTP response is sent indicating the reason and status code (typically 400, "Bad Request"). This counts as a failure.
Name |
Description |
---|---|
|
An object containing the HTTP Upgrade request. Ownership is not transferred, the implementation will not access this object from other threads. |
Type |
Thrown On |
---|---|
|
Thrown on failure. |