ゴミ箱
|
Namespaces | |
detail | |
Classes | |
struct | close_reason |
struct | permessage_deflate |
class | stream |
Typedefs | |
using | reason_string = static_string< 123, char > |
The type representing the reason string in a close frame. More... | |
using | ping_data = static_string< 125, char > |
The type representing the payload of ping and pong messages. More... | |
using | request_type = http::request< http::empty_body > |
The type of object holding HTTP Upgrade requests. More... | |
using | response_type = http::response< http::string_body > |
The type of object holding HTTP Upgrade responses. More... | |
Enumerations | |
enum | error { error::closed = 1, error::failed, error::handshake_failed, error::buffer_overflow } |
Error codes returned from beast::websocket::stream operations. More... | |
enum | close_code : std::uint16_t { normal = 1000, going_away = 1001, protocol_error = 1002, unknown_data = 1003, bad_payload = 1007, policy_error = 1008, too_big = 1009, needs_extension = 1010, internal_error = 1011, service_restart = 1012, try_again_later = 1013, none = 0, reserved1 = 1004, no_status = 1005, abnormal = 1006, reserved2 = 1014, reserved3 = 1015 } |
enum | role_type { role_type::client, role_type::server } |
enum | frame_type { frame_type::close, frame_type::ping, frame_type::pong } |
Functions | |
error_code | make_error_code (error e) |
template<class Allocator > | |
bool | is_upgrade (http::header< true, http::basic_fields< Allocator >> const &req) |
template<class AsyncStream > | |
void | teardown (role_type, boost::asio::ssl::stream< AsyncStream > &stream, error_code &ec) |
template<class AsyncStream , class TeardownHandler > | |
void | async_teardown (role_type, boost::asio::ssl::stream< AsyncStream > &stream, TeardownHandler &&handler) |
void | teardown (role_type role, boost::asio::ip::tcp::socket &socket, error_code &ec) |
template<class TeardownHandler > | |
void | async_teardown (role_type role, boost::asio::ip::tcp::socket &socket, TeardownHandler &&handler) |
template<class SyncStream > | |
void | teardown (role_type role, boost::asio::ssl::stream< SyncStream > &stream, error_code &ec) |
template<class Socket > | |
void | teardown (role_type role, Socket &socket, error_code &ec) |
template<class Socket , class TeardownHandler > | |
void | async_teardown (role_type role, Socket &socket, TeardownHandler &&handler) |
using boost::beast::websocket::ping_data = typedef static_string<125, char> |
The type representing the payload of ping and pong messages.
using boost::beast::websocket::reason_string = typedef static_string<123, char> |
The type representing the reason string in a close frame.
using boost::beast::websocket::request_type = typedef http::request<http::empty_body> |
The type of object holding HTTP Upgrade requests.
using boost::beast::websocket::response_type = typedef http::response<http::string_body> |
The type of object holding HTTP Upgrade responses.
enum boost::beast::websocket::close_code : std::uint16_t |
Close status codes.
These codes accompany close frames.
|
strong |
Error codes returned from beast::websocket::stream operations.
Enumerator | |
---|---|
closed |
Both sides performed a WebSocket close. |
failed |
WebSocket connection failed, protocol violation. |
handshake_failed |
Upgrade handshake failed. |
buffer_overflow |
buffer overflow |
|
strong |
The type of received control frame.
Values of this type are passed to the control frame callback set using stream::control_callback.
Enumerator | |
---|---|
close |
A close frame was received. |
ping |
A ping frame was received. |
pong |
A pong frame was received. |
|
strong |
The role of the websocket stream endpoint.
Whether the endpoint is a client or server affects the behavior of the Close the WebSocket Connection operation described in rfc6455 section 7.1.1. The shutdown behavior depends on the type of the next layer template parameter used to construct the stream. Other next layer types including user-defined types may implement different role-based behavior when performing the close operation.
The default implementation for stream when the next layer type is a boost::asio::ip::tcp::socket
behaves as follows:
When the next layer type is a boost::asio::ssl::stream
, the connection is closed by performing the SSL closing handshake corresponding to the role type, client or server.
Enumerator | |
---|---|
client |
The stream is operating as a client. |
server |
The stream is operating as a server. |
|
inline |
Start tearing down a boost::asio::ssl::stream
.
This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the Stream
parameter used to consruct the socket. When Stream
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
stream | The stream to tear down. |
handler | The handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post(). |
void boost::beast::websocket::async_teardown | ( | role_type | role, |
Socket & | socket, | ||
TeardownHandler && | handler | ||
) |
Start tearing down a connection.
This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the Socket
parameter used to consruct the socket. When Stream
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
socket | The socket to tear down. |
handler | The handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post(). |
|
inline |
Start tearing down a boost::asio::ip::tcp::socket
.
This begins tearing down a connection asynchronously. The implementation will call the overload of this function based on the Stream
parameter used to consruct the socket. When Stream
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
socket | The socket to tear down. |
handler | The handler to be called when the request completes. Copies will be made of the handler as required. The equivalent function signature of the handler must be: Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using boost::asio::io_service::post(). |
bool boost::beast::websocket::is_upgrade | ( | beast::http::header< true, http::basic_fields< Allocator >> const & | req | ) |
Returns true
if the specified HTTP request is a WebSocket Upgrade.
This function returns true
when the passed HTTP Request indicates a WebSocket Upgrade. It does not validate the contents of the fields: it just trivially accepts requests which could only possibly be a valid or invalid WebSocket Upgrade message.
Callers who wish to manually read HTTP requests in their server implementation can use this function to determine if the request should be routed to an instance of websocket::stream.
req | The HTTP Request object to check. |
true
if the request is a WebSocket Upgrade.
|
inline |
void boost::beast::websocket::teardown | ( | role_type | , |
boost::asio::ssl::stream< AsyncStream > & | stream, | ||
error_code & | ec | ||
) |
void boost::beast::websocket::teardown | ( | role_type | role, |
boost::asio::ssl::stream< SyncStream > & | stream, | ||
error_code & | ec | ||
) |
Tear down a boost::asio::ssl::stream
.
This tears down a connection. The implementation will call the overload of this function based on the Stream
parameter used to consruct the socket. When Stream
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
stream | The stream to tear down. |
ec | Set to the error if any occurred. |
void boost::beast::websocket::teardown | ( | role_type | role, |
Socket & | socket, | ||
error_code & | ec | ||
) |
Tear down a connection.
This tears down a connection. The implementation will call the overload of this function based on the Socket
parameter used to consruct the socket. When Socket
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
socket | The socket to tear down. |
ec | Set to the error if any occurred. |
|
inline |
Tear down a boost::asio::ip::tcp::socket
.
This tears down a connection. The implementation will call the overload of this function based on the Stream
parameter used to consruct the socket. When Stream
is a user defined type, and not a boost::asio::ip::tcp::socket
or any boost::asio::ssl::stream
, callers are responsible for providing a suitable overload of this function.
role | The role of the local endpoint |
socket | The socket to tear down. |
ec | Set to the error if any occurred. |