公共类型:
#include <connection.hpp>
Public Types | |
typedef connection< config > | type |
此连接的类型 | Type of this connection. |
typedef lib::shared_ptr< type > | ptr |
指向此连接的共享指针的类型 | Type of a shared pointer to this connection. |
typedef lib::weak_ptr< type > | weak_ptr |
指向此连接的弱指针的类型。 | Type of a weak pointer to this connection. |
typedef config::concurrency_type | concurrency_type |
此连接的并发组件的类型。 | Type of the concurrency component of this connection. |
typedef config::alog_type | alog_type |
访问日志策略类型。 | Type of the access logging policy. |
typedef config::elog_type | elog_type |
错误日志记录策略的类型 | Type of the error logging policy. |
typedef config::transport_type::transport_con_type | transport_con_type |
此连接的传输组件的类型。 | Type of the transport component of this connection. |
typedef transport_con_type::ptr | transport_con_ptr |
指向此连接的传输组件的共享指针的类型。 | Type of a shared pointer to the transport component of this connection. |
typedef lib::function< void(ptr)> | termination_handler |
typedef concurrency_type::scoped_lock_type | scoped_lock_type |
typedef concurrency_type::mutex_type | mutex_type |
typedef config::request_type | request_type |
typedef config::response_type | response_type |
typedef config::message_type | message_type |
typedef message_type::ptr | message_ptr |
typedef config::con_msg_manager_type | con_msg_manager_type |
typedef con_msg_manager_type::ptr | con_msg_manager_ptr |
typedef config::rng_type | rng_type |
Type of RNG. | |
typedef processor::processor< config > | processor_type |
typedef lib::shared_ptr< processor_type > | processor_ptr |
typedef lib::function< void(connection_hdl, message_ptr)> | message_handler |
typedef transport_con_type::timer_ptr | timer_ptr |
Type of a pointer to a transport timer handle. | |
typedef session::internal_state::value | istate_type |
Public Member Functions | |
connection (bool p_is_server, std::string const &ua, const lib::shared_ptr< alog_type > &alog, const lib::shared_ptr< elog_type > &elog, rng_type &rng) | |
ptr | get_shared () |
Get a shared pointer to this component. | |
void | set_open_handler (open_handler h) |
Set open handler. More... | |
void | set_close_handler (close_handler h) |
Set close handler. More... | |
void | set_fail_handler (fail_handler h) |
Set fail handler. More... | |
void | set_ping_handler (ping_handler h) |
Set ping handler. More... | |
void | set_pong_handler (pong_handler h) |
Set pong handler. More... | |
void | set_pong_timeout_handler (pong_timeout_handler h) |
Set pong timeout handler. More... | |
void | set_interrupt_handler (interrupt_handler h) |
Set interrupt handler. More... | |
void | set_http_handler (http_handler h) |
Set http handler. More... | |
void | set_validate_handler (validate_handler h) |
Set validate handler. More... | |
void | set_message_handler (message_handler h) |
Set message handler. More... | |
void | set_open_handshake_timeout (long dur) |
Set open handshake timeout. More... | |
void | set_close_handshake_timeout (long dur) |
Set close handshake timeout. More... | |
void | set_pong_timeout (long dur) |
Set pong timeout. More... | |
size_t | get_max_message_size () const |
Get maximum message size. More... | |
void | set_max_message_size (size_t new_value) |
Set maximum message size. More... | |
size_t | get_max_http_body_size () const |
Get maximum HTTP message body size. More... | |
void | set_max_http_body_size (size_t new_value) |
Set maximum HTTP message body size. More... | |
size_t | get_buffered_amount () const |
Get the size of the outgoing write buffer (in payload bytes) More... | |
size_t | buffered_amount () const |
Get the size of the outgoing write buffer (in payload bytes) More... | |
lib::error_code | send (std::string const &payload, frame::opcode::value op=frame::opcode::text) |
Create a message and then add it to the outgoing send queue. More... | |
lib::error_code | send (void const *payload, size_t len, frame::opcode::value op=frame::opcode::binary) |
Send a message (raw array overload) More... | |
lib::error_code | send (message_ptr msg) |
Add a message to the outgoing send queue. More... | |
lib::error_code | interrupt () |
Asyncronously invoke handler::on_inturrupt. More... | |
void | handle_interrupt () |
Transport inturrupt callback. | |
lib::error_code | pause_reading () |
Pause reading of new data. More... | |
void | handle_pause_reading () |
Pause reading callback. More... | |
lib::error_code | resume_reading () |
Resume reading of new data. More... | |
void | handle_resume_reading () |
Resume reading callback. More... | |
void | ping (std::string const &payload) |
Send a ping. More... | |
void | ping (std::string const &payload, lib::error_code &ec) |
exception free variant of ping | |
void | handle_pong_timeout (std::string payload, lib::error_code const &ec) |
Utility method that gets called back when the ping timer expires. | |
void | pong (std::string const &payload) |
Send a pong. More... | |
void | pong (std::string const &payload, lib::error_code &ec) |
exception free variant of pong | |
void | close (close::status::value const code, std::string const &reason) |
Close the connection. More... | |
void | close (close::status::value const code, std::string const &reason, lib::error_code &ec) |
exception free variant of close | |
bool | get_secure () const |
Returns the secure flag from the connection URI. More... | |
std::string const & | get_host () const |
Returns the host component of the connection URI. More... | |
std::string const & | get_resource () const |
Returns the resource component of the connection URI. More... | |
uint16_t | get_port () const |
Returns the port component of the connection URI. More... | |
uri_ptr | get_uri () const |
Gets the connection URI. More... | |
void | set_uri (uri_ptr uri) |
Sets the connection URI. More... | |
std::string const & | get_subprotocol () const |
Gets the negotated subprotocol. More... | |
std::vector< std::string > const & | get_requested_subprotocols () const |
Gets all of the subprotocols requested by the client. More... | |
void | add_subprotocol (std::string const &request, lib::error_code &ec) |
Adds the given subprotocol string to the request list (exception free) More... | |
void | add_subprotocol (std::string const &request) |
Adds the given subprotocol string to the request list (exception) More... | |
void | select_subprotocol (std::string const &value, lib::error_code &ec) |
Select a subprotocol to use (exception free) More... | |
void | select_subprotocol (std::string const &value) |
Select a subprotocol to use (exception) More... | |
std::string const & | get_request_header (std::string const &key) const |
Retrieve a request header. More... | |
std::string const & | get_request_body () const |
Retrieve a request body. More... | |
std::string const & | get_response_header (std::string const &key) const |
Retrieve a response header. More... | |
http::status_code::value | get_response_code () const |
Get response HTTP status code. More... | |
std::string const & | get_response_msg () const |
Get response HTTP status message. More... | |
void | set_status (http::status_code::value code, lib::error_code &ec) |
Set response status code and message (exception free) More... | |
void | set_status (http::status_code::value code) |
Set response status code and message (exception) More... | |
void | set_status (http::status_code::value code, std::string const &msg, lib::error_code &ec) |
Set response status code and message (exception free) More... | |
void | set_status (http::status_code::value code, std::string const &msg) |
Set response status code and message (exception) More... | |
void | set_body (std::string const &value, lib::error_code &ec) |
Set response body content (exception free) More... | |
void | set_body (std::string const &value) |
Set response body content (exception) More... | |
void | append_header (std::string const &key, std::string const &val, lib::error_code &ec) |
Append a header (exception free) More... | |
void | append_header (std::string const &key, std::string const &val) |
Append a header (exception) More... | |
void | replace_header (std::string const &key, std::string const &val, lib::error_code &ec) |
Replace a header (exception free) More... | |
void | replace_header (std::string const &key, std::string const &val) |
Replace a header (exception) More... | |
void | remove_header (std::string const &key, lib::error_code &ec) |
Remove a header (exception free) More... | |
void | remove_header (std::string const &key) |
Remove a header (exception) More... | |
request_type const & | get_request () const |
Get request object. More... | |
response_type const & | get_response () const |
Get response object. More... | |
lib::error_code | defer_http_response () |
Defer HTTP Response until later (Exception free) More... | |
void | send_http_response (lib::error_code &ec) |
Send deferred HTTP Response (exception free) More... | |
void | send_http_response () |
Send deferred HTTP Response. | |
connection_hdl | get_handle () const |
Get Connection Handle. More... | |
bool | is_server () const |
Get whether or not this connection is part of a server or client. More... | |
std::string const & | get_origin () const |
Return the same origin policy origin value from the opening request. More... | |
session::state::value | get_state () const |
Return the connection state. More... | |
close::status::value | get_local_close_code () const |
Get the WebSocket close code sent by this endpoint. More... | |
std::string const & | get_local_close_reason () const |
Get the WebSocket close reason sent by this endpoint. More... | |
close::status::value | get_remote_close_code () const |
Get the WebSocket close code sent by the remote endpoint. More... | |
std::string const & | get_remote_close_reason () const |
Get the WebSocket close reason sent by the remote endpoint. More... | |
lib::error_code | get_ec () const |
Get the internal error code for a closed/failed connection. More... | |
message_ptr | get_message (websocketpp::frame::opcode::value op, size_t size) const |
Get a message buffer. More... | |
void | read_handshake (size_t num_bytes) |
void | handle_read_handshake (lib::error_code const &ec, size_t bytes_transferred) |
void | handle_read_http_response (lib::error_code const &ec, size_t bytes_transferred) |
void | handle_write_http_response (lib::error_code const &ec) |
void | handle_send_http_request (lib::error_code const &ec) |
void | handle_open_handshake_timeout (lib::error_code const &ec) |
void | handle_close_handshake_timeout (lib::error_code const &ec) |
void | handle_read_frame (lib::error_code const &ec, size_t bytes_transferred) |
void | read_frame () |
Issue a new transport read unless reading is paused. | |
std::vector< int > const & | get_supported_versions () const |
Get array of WebSocket protocol versions that this connection supports. | |
void | set_termination_handler (termination_handler new_handler) |
void | terminate (lib::error_code const &ec) |
void | handle_terminate (terminate_status tstat, lib::error_code const &ec) |
void | write_frame () |
Checks if there are frames in the send queue and if there are sends one. More... | |
void | handle_write_frame (lib::error_code const &ec) |
Process the results of a frame write operation and start the next write. More... | |
void | start () |
Start the connection state machine. | |
void | set_handle (connection_hdl hdl) |
Set Connection Handle. More... |