Creates and manages connections associated with a WebSocket endpoint. More...
#include <endpoint.hpp>
Public Types | |
typedef endpoint< connection, config > | type |
typedef config::transport_type | transport_type |
Type of the transport component of this endpoint. More... | |
typedef config::concurrency_type | concurrency_type |
Type of the concurrency component of this endpoint. More... | |
typedef connection | connection_type |
Type of the connections that this endpoint creates. More... | |
typedef connection_type::ptr | connection_ptr |
Shared pointer to connection_type. More... | |
typedef connection_type::weak_ptr | connection_weak_ptr |
Weak pointer to connection type. More... | |
typedef transport_type::transport_con_type | transport_con_type |
Type of the transport component of the connections that this endpoint creates. More... | |
typedef transport_con_type::ptr | transport_con_ptr |
Type of a shared pointer to the transport component of the connections that this endpoint creates. More... | |
typedef connection_type::message_handler | message_handler |
Type of message_handler. More... | |
typedef connection_type::message_ptr | message_ptr |
Type of message pointers that this endpoint uses. More... | |
typedef config::elog_type | elog_type |
Type of error logger. More... | |
typedef config::alog_type | alog_type |
Type of access logger. More... | |
typedef concurrency_type::scoped_lock_type | scoped_lock_type |
Type of our concurrency policy's scoped lock object. More... | |
typedef concurrency_type::mutex_type | mutex_type |
Type of our concurrency policy's mutex object. More... | |
typedef config::rng_type | rng_type |
Type of RNG. More... | |
typedef connection_type::termination_handler | termination_handler |
Public Types inherited from websocketpp::transport::asio::endpoint< config > | |
typedef endpoint< config > | type |
Type of this endpoint transport component. More... | |
typedef config::concurrency_type | concurrency_type |
Type of the concurrency policy. More... | |
typedef config::socket_type | socket_type |
Type of the socket policy. More... | |
typedef config::elog_type | elog_type |
Type of the error logging policy. More... | |
typedef config::alog_type | alog_type |
Type of the access logging policy. More... | |
typedef socket_type::socket_con_type | socket_con_type |
Type of the socket connection component. More... | |
typedef socket_con_type::ptr | socket_con_ptr |
Type of a shared pointer to the socket connection component. More... | |
typedef asio::connection< config > | transport_con_type |
Type of the connection transport component associated with this endpoint transport component. More... | |
typedef transport_con_type::ptr | transport_con_ptr |
Type of a shared pointer to the connection transport component associated with this endpoint transport component. More... | |
typedef lib::asio::io_service * | io_service_ptr |
Type of a pointer to the ASIO io_service being used. More... | |
typedef lib::shared_ptr< lib::asio::ip::tcp::acceptor > | acceptor_ptr |
Type of a shared pointer to the acceptor being used. More... | |
typedef lib::shared_ptr< lib::asio::ip::tcp::resolver > | resolver_ptr |
Type of a shared pointer to the resolver being used. More... | |
typedef lib::shared_ptr< lib::asio::steady_timer > | timer_ptr |
Type of timer handle. More... | |
typedef lib::shared_ptr< lib::asio::io_service::work > | work_ptr |
Type of a shared pointer to an io_service work object. More... | |
Public Types inherited from websocketpp::transport::asio::tls_socket::endpoint | |
typedef endpoint | type |
The type of this endpoint socket component. More... | |
typedef connection | socket_con_type |
The type of the corresponding connection socket component. More... | |
typedef socket_con_type::ptr | socket_con_ptr |
The type of a shared pointer to the corresponding connection socket component. More... | |
Public Member Functions | |
endpoint (bool p_is_server) | |
~endpoint () | |
Destructor. More... | |
std::string | get_user_agent () const |
Returns the user agent string that this endpoint will use. More... | |
void | set_user_agent (std::string const &ua) |
Sets the user agent string that this endpoint will use. More... | |
bool | is_server () const |
Returns whether or not this endpoint is a server. More... | |
void | set_access_channels (log::level channels) |
Set Access logging channel. More... | |
void | clear_access_channels (log::level channels) |
Clear Access logging channels. More... | |
void | set_error_channels (log::level channels) |
Set Error logging channel. More... | |
void | clear_error_channels (log::level channels) |
Clear Error logging channels. More... | |
alog_type & | get_alog () |
Get reference to access logger. More... | |
elog_type & | get_elog () |
Get reference to error logger. More... | |
void | set_open_handler (open_handler h) |
void | set_close_handler (close_handler h) |
void | set_fail_handler (fail_handler h) |
void | set_ping_handler (ping_handler h) |
void | set_pong_handler (pong_handler h) |
void | set_pong_timeout_handler (pong_timeout_handler h) |
void | set_interrupt_handler (interrupt_handler h) |
void | set_http_handler (http_handler h) |
void | set_validate_handler (validate_handler h) |
void | set_message_handler (message_handler h) |
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 default maximum message size. More... | |
void | set_max_message_size (size_t new_value) |
Set default 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... | |
void | interrupt (connection_hdl hdl, lib::error_code &ec) |
These functions act as adaptors to their counterparts in connection. More... | |
void | interrupt (connection_hdl hdl) |
void | pause_reading (connection_hdl hdl, lib::error_code &ec) |
Pause reading of new data (exception free) More... | |
void | pause_reading (connection_hdl hdl) |
Pause reading of new data. More... | |
void | resume_reading (connection_hdl hdl, lib::error_code &ec) |
Resume reading of new data (exception free) More... | |
void | resume_reading (connection_hdl hdl) |
Resume reading of new data. More... | |
void | send_http_response (connection_hdl hdl, lib::error_code &ec) |
Send deferred HTTP Response. More... | |
void | send_http_response (connection_hdl hdl) |
Send deferred HTTP Response (exception free) More... | |
void | send (connection_hdl hdl, std::string const &payload, frame::opcode::value op, lib::error_code &ec) |
Create a message and add it to the outgoing send queue (exception free) More... | |
void | send (connection_hdl hdl, std::string const &payload, frame::opcode::value op) |
Create a message and add it to the outgoing send queue. More... | |
void | send (connection_hdl hdl, void const *payload, size_t len, frame::opcode::value op, lib::error_code &ec) |
void | send (connection_hdl hdl, void const *payload, size_t len, frame::opcode::value op) |
void | send (connection_hdl hdl, message_ptr msg, lib::error_code &ec) |
void | send (connection_hdl hdl, message_ptr msg) |
void | close (connection_hdl hdl, close::status::value const code, std::string const &reason, lib::error_code &ec) |
void | close (connection_hdl hdl, close::status::value const code, std::string const &reason) |
void | ping (connection_hdl hdl, std::string const &payload, lib::error_code &ec) |
Send a ping to a specific connection. More... | |
void | ping (connection_hdl hdl, std::string const &payload) |
Send a ping to a specific connection. More... | |
void | pong (connection_hdl hdl, std::string const &payload, lib::error_code &ec) |
Send a pong to a specific connection. More... | |
void | pong (connection_hdl hdl, std::string const &payload) |
Send a pong to a specific connection. More... | |
connection_ptr | get_con_from_hdl (connection_hdl hdl, lib::error_code &ec) |
Retrieves a connection_ptr from a connection_hdl (exception free) More... | |
connection_ptr | get_con_from_hdl (connection_hdl hdl) |
Retrieves a connection_ptr from a connection_hdl (exception version) More... | |
Public Member Functions inherited from websocketpp::transport::asio::endpoint< config > | |
endpoint () | |
~endpoint () | |
bool | is_secure () const |
Return whether or not the endpoint produces secure connections. More... | |
void | init_asio (io_service_ptr ptr, lib::error_code &ec) |
initialize asio transport with external io_service (exception free) More... | |
void | init_asio (io_service_ptr ptr) |
initialize asio transport with external io_service More... | |
void | init_asio (lib::error_code &ec) |
Initialize asio transport with internal io_service (exception free) More... | |
void | init_asio () |
Initialize asio transport with internal io_service. More... | |
void | set_tcp_pre_init_handler (tcp_init_handler h) |
Sets the tcp pre init handler. More... | |
void | set_tcp_init_handler (tcp_init_handler h) |
Sets the tcp pre init handler (deprecated) More... | |
void | set_tcp_post_init_handler (tcp_init_handler h) |
Sets the tcp post init handler. More... | |
void | set_listen_backlog (int backlog) |
Sets the maximum length of the queue of pending connections. More... | |
void | set_reuse_addr (bool value) |
Sets whether to use the SO_REUSEADDR flag when opening listening sockets. More... | |
lib::asio::io_service & | get_io_service () |
Retrieve a reference to the endpoint's io_service. More... | |
lib::asio::ip::tcp::endpoint | get_local_endpoint (lib::asio::error_code &ec) |
Get local TCP endpoint. More... | |
void | listen (lib::asio::ip::tcp::endpoint const &ep, lib::error_code &ec) |
Set up endpoint for listening manually (exception free) More... | |
void | listen (lib::asio::ip::tcp::endpoint const &ep) |
Set up endpoint for listening manually. More... | |
template<typename InternetProtocol > | |
void | listen (InternetProtocol const &internet_protocol, uint16_t port, lib::error_code &ec) |
Set up endpoint for listening with protocol and port (exception free) More... | |
template<typename InternetProtocol > | |
void | listen (InternetProtocol const &internet_protocol, uint16_t port) |
Set up endpoint for listening with protocol and port. More... | |
void | listen (uint16_t port, lib::error_code &ec) |
Set up endpoint for listening on a port (exception free) More... | |
void | listen (uint16_t port) |
Set up endpoint for listening on a port. More... | |
void | listen (std::string const &host, std::string const &service, lib::error_code &ec) |
Set up endpoint for listening on a host and service (exception free) More... | |
void | listen (std::string const &host, std::string const &service) |
Set up endpoint for listening on a host and service. More... | |
void | stop_listening (lib::error_code &ec) |
Stop listening (exception free) More... | |
void | stop_listening () |
Stop listening. More... | |
bool | is_listening () const |
Check if the endpoint is listening. More... | |
std::size_t | run () |
wraps the run method of the internal io_service object More... | |
std::size_t | run_one () |
wraps the run_one method of the internal io_service object More... | |
void | stop () |
wraps the stop method of the internal io_service object More... | |
std::size_t | poll () |
wraps the poll method of the internal io_service object More... | |
std::size_t | poll_one () |
wraps the poll_one method of the internal io_service object More... | |
void | reset () |
wraps the reset method of the internal io_service object More... | |
bool | stopped () const |
wraps the stopped method of the internal io_service object More... | |
void | start_perpetual () |
Marks the endpoint as perpetual, stopping it from exiting when empty. More... | |
void | stop_perpetual () |
Clears the endpoint's perpetual flag, allowing it to exit when empty. More... | |
timer_ptr | set_timer (long duration, timer_handler callback) |
Call back a function after a period of time. More... | |
void | handle_timer (timer_ptr, timer_handler callback, lib::asio::error_code const &ec) |
Timer handler. More... | |
void | async_accept (transport_con_ptr tcon, accept_handler callback, lib::error_code &ec) |
Accept the next connection attempt and assign it to con (exception free) More... | |
void | async_accept (transport_con_ptr tcon, accept_handler callback) |
Accept the next connection attempt and assign it to con. More... | |
Public Member Functions inherited from websocketpp::transport::asio::tls_socket::endpoint | |
endpoint () | |
bool | is_secure () const |
Checks whether the endpoint creates secure connections. More... | |
void | set_socket_init_handler (socket_init_handler h) |
Set socket init handler. More... | |
void | set_tls_init_handler (tls_init_handler h) |
Set TLS init handler. More... | |
Protected Member Functions | |
connection_ptr | create_connection () |
Protected Member Functions inherited from websocketpp::transport::asio::endpoint< config > | |
void | init_logging (alog_type *a, elog_type *e) |
Initialize logging. More... | |
void | handle_accept (accept_handler callback, lib::asio::error_code const &asio_ec) |
void | async_connect (transport_con_ptr tcon, uri_ptr u, connect_handler cb) |
Initiate a new connection. More... | |
void | handle_resolve_timeout (timer_ptr, connect_handler callback, lib::error_code const &ec) |
DNS resolution timeout handler. More... | |
void | handle_resolve (transport_con_ptr tcon, timer_ptr dns_timer, connect_handler callback, lib::asio::error_code const &ec, lib::asio::ip::tcp::resolver::iterator iterator) |
void | handle_connect_timeout (transport_con_ptr tcon, timer_ptr, connect_handler callback, lib::error_code const &ec) |
Asio connect timeout handler. More... | |
void | handle_connect (transport_con_ptr tcon, timer_ptr con_timer, connect_handler callback, lib::asio::error_code const &ec) |
lib::error_code | init (transport_con_ptr tcon) |
Initialize a connection. More... | |
Protected Member Functions inherited from websocketpp::transport::asio::tls_socket::endpoint | |
lib::error_code | init (socket_con_ptr scon) |
Initialize a connection. More... | |
Protected Attributes | |
alog_type | m_alog |
elog_type | m_elog |
Creates and manages connections associated with a WebSocket endpoint.
Definition at line 42 of file endpoint.hpp.
typedef endpoint<connection,config> websocketpp::endpoint< connection, config >::type |
Definition at line 46 of file endpoint.hpp.
typedef config::transport_type websocketpp::endpoint< connection, config >::transport_type |
Type of the transport component of this endpoint.
Definition at line 49 of file endpoint.hpp.
typedef config::concurrency_type websocketpp::endpoint< connection, config >::concurrency_type |
Type of the concurrency component of this endpoint.
Definition at line 51 of file endpoint.hpp.
typedef connection websocketpp::endpoint< connection, config >::connection_type |
Type of the connections that this endpoint creates.
Definition at line 54 of file endpoint.hpp.
typedef connection_type::ptr websocketpp::endpoint< connection, config >::connection_ptr |
Shared pointer to connection_type.
Definition at line 56 of file endpoint.hpp.
typedef connection_type::weak_ptr websocketpp::endpoint< connection, config >::connection_weak_ptr |
Weak pointer to connection type.
Definition at line 58 of file endpoint.hpp.
typedef transport_type::transport_con_type websocketpp::endpoint< connection, config >::transport_con_type |
Type of the transport component of the connections that this endpoint creates.
Definition at line 62 of file endpoint.hpp.
typedef transport_con_type::ptr websocketpp::endpoint< connection, config >::transport_con_ptr |
Type of a shared pointer to the transport component of the connections that this endpoint creates.
Definition at line 65 of file endpoint.hpp.
typedef connection_type::message_handler websocketpp::endpoint< connection, config >::message_handler |
Type of message_handler.
Definition at line 68 of file endpoint.hpp.
typedef connection_type::message_ptr websocketpp::endpoint< connection, config >::message_ptr |
Type of message pointers that this endpoint uses.
Definition at line 70 of file endpoint.hpp.
typedef config::elog_type websocketpp::endpoint< connection, config >::elog_type |
Type of error logger.
Definition at line 73 of file endpoint.hpp.
typedef config::alog_type websocketpp::endpoint< connection, config >::alog_type |
Type of access logger.
Definition at line 75 of file endpoint.hpp.
typedef concurrency_type::scoped_lock_type websocketpp::endpoint< connection, config >::scoped_lock_type |
Type of our concurrency policy's scoped lock object.
Definition at line 78 of file endpoint.hpp.
typedef concurrency_type::mutex_type websocketpp::endpoint< connection, config >::mutex_type |
Type of our concurrency policy's mutex object.
Definition at line 80 of file endpoint.hpp.
typedef config::rng_type websocketpp::endpoint< connection, config >::rng_type |
Type of RNG.
Definition at line 83 of file endpoint.hpp.
typedef connection_type::termination_handler websocketpp::endpoint< connection, config >::termination_handler |
Definition at line 86 of file endpoint.hpp.
|
inlineexplicit |
Definition at line 91 of file endpoint.hpp.
|
inline |
Destructor.
Definition at line 112 of file endpoint.hpp.
|
inline |
Returns the user agent string that this endpoint will use.
Returns the user agent string that this endpoint will use when creating new connections.
The default value for this version is stored in websocketpp::user_agent
Definition at line 169 of file endpoint.hpp.
|
inline |
Sets the user agent string that this endpoint will use.
Sets the identifier that this endpoint will use when creating new connections. Changing this value will only affect future connections. For client endpoints this will be sent as the "User-Agent" header in outgoing requests. For server endpoints this will be sent in the "Server" response header.
Setting this value to the empty string will suppress the use of the Server and User-Agent headers. This is typically done to hide implementation details for security purposes.
For best results set this before accepting or opening connections.
The default value for this version is stored in websocketpp::user_agent
This can be overridden on an individual connection basis by setting a custom "Server" header during the validate handler or "User-Agent" header on a connection before calling connect().
ua | The string to set the user agent to. |
Definition at line 196 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Returns whether or not this endpoint is a server.
Definition at line 205 of file endpoint.hpp.
|
inline |
Set Access logging channel.
Set the access logger's channel value. The value is a number whose interpretation depends on the logging policy in use.
channels | The channel value(s) to set |
Definition at line 220 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), perftest::perftest(), run_client(), run_server(), run_server_test(), run_time_limited_client(), telemetry_client::telemetry_client(), telemetry_server::telemetry_server(), and utility_server::utility_server().
|
inline |
Clear Access logging channels.
Clear the access logger's channel value. The value is a number whose interpretation depends on the logging policy in use.
channels | The channel value(s) to clear |
Definition at line 231 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), run_client(), run_server(), run_server_test(), run_time_limited_client(), telemetry_client::telemetry_client(), telemetry_server::telemetry_server(), websocket_endpoint::websocket_endpoint(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Set Error logging channel.
Set the error logger's channel value. The value is a number whose interpretation depends on the logging policy in use.
channels | The channel value(s) to set |
Definition at line 242 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), perftest::perftest(), run_client(), run_server(), run_server_test(), run_time_limited_client(), and utility_server::utility_server().
|
inline |
Clear Error logging channels.
Clear the error logger's channel value. The value is a number whose interpretation depends on the logging policy in use.
channels | The channel value(s) to clear |
Definition at line 253 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), run_client(), run_server(), run_server_test(), run_time_limited_client(), websocket_endpoint::websocket_endpoint(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Get reference to access logger.
Definition at line 261 of file endpoint.hpp.
Referenced by main(), telemetry_client::on_close(), telemetry_client::on_fail(), telemetry_server::on_http(), on_message(), telemetry_client::on_open(), on_ping(), telemetry_server::on_timer(), telemetry_client::run(), telemetry_server::run(), perftest::start(), and telemetry_client::telemetry_loop().
|
inline |
Get reference to error logger.
Definition at line 269 of file endpoint.hpp.
Referenced by main().
|
inline |
Definition at line 277 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), broadcast_server::broadcast_server(), count_server::count_server(), main(), perftest::perftest(), telemetry_client::telemetry_client(), telemetry_server::telemetry_server(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Definition at line 282 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), broadcast_server::broadcast_server(), count_server::count_server(), main(), perftest::perftest(), telemetry_client::telemetry_client(), telemetry_server::telemetry_server(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Definition at line 287 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), perftest::perftest(), and telemetry_client::telemetry_client().
|
inline |
Definition at line 292 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 297 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Definition at line 302 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Definition at line 307 of file endpoint.hpp.
|
inline |
Definition at line 312 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), and telemetry_server::telemetry_server().
|
inline |
Definition at line 317 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), and main().
|
inline |
Definition at line 322 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), broadcast_server::broadcast_server(), main(), perftest::perftest(), utility_server::utility_server(), and nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Set open handshake timeout.
Sets the length of time the library will wait after an opening handshake has been initiated before cancelling it. This can be used to prevent excessive wait times for outgoing clients or excessive resource usage from broken clients or DoS attacks on servers.
Connections that time out will have their fail handlers called with the open_handshake_timeout error code.
The default value is specified via the compile time config value 'timeout_open_handshake'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.
To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.
dur | The length of the open handshake timeout in ms |
Definition at line 352 of file endpoint.hpp.
|
inline |
Set close handshake timeout.
Sets the length of time the library will wait after a closing handshake has been initiated before cancelling it. This can be used to prevent excessive wait times for outgoing clients or excessive resource usage from broken clients or DoS attacks on servers.
Connections that time out will have their close handlers called with the close_handshake_timeout error code.
The default value is specified via the compile time config value 'timeout_close_handshake'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.
To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.
dur | The length of the close handshake timeout in ms |
Definition at line 377 of file endpoint.hpp.
|
inline |
Set pong timeout.
Sets the length of time the library will wait for a pong response to a ping. This can be used as a keepalive or to detect broken connections.
Pong responses that time out will have the pong timeout handler called.
The default value is specified via the compile time config value 'timeout_pong'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.
To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.
dur | The length of the pong timeout in ms |
Definition at line 399 of file endpoint.hpp.
Referenced by nfd::face::WebSocketChannel::WebSocketChannel().
|
inline |
Get default maximum message size.
Get the default maximum message size that will be used for new connections created by this endpoint. The maximum message size determines the point at which the connection will fail a connection with the message_too_big protocol error.
The default is set by the max_message_size value from the template config
Definition at line 415 of file endpoint.hpp.
|
inline |
Set default maximum message size.
Set the default maximum message size that will be used for new connections created by this endpoint. Maximum message size determines the point at which the connection will fail a connection with the message_too_big protocol error.
The default is set by the max_message_size value from the template config
new_value | The value to set as the maximum message size. |
Definition at line 432 of file endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Get maximum HTTP message body size.
Get maximum HTTP message body size. Maximum message body size determines the point at which the connection will stop reading an HTTP request whose body is too large.
The default is set by the max_http_body_size value from the template config
Definition at line 449 of file endpoint.hpp.
|
inline |
Set maximum HTTP message body size.
Set maximum HTTP message body size. Maximum message body size determines the point at which the connection will stop reading an HTTP request whose body is too large.
The default is set by the max_http_body_size value from the template config
new_value | The value to set as the maximum message size. |
Definition at line 466 of file endpoint.hpp.
void websocketpp::endpoint< connection, config >::interrupt | ( | connection_hdl | hdl, |
lib::error_code & | ec | ||
) |
These functions act as adaptors to their counterparts in connection.
They can produce one additional type of error, the bad_connection error, that indicates that the conversion from connection_hdl to connection_ptr failed due to the connection not existing anymore. Each method has a default and an exception free varient.
Definition at line 96 of file endpoint_impl.hpp.
References websocketpp::log::alevel::devel.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::interrupt | ( | connection_hdl | hdl | ) |
Definition at line 107 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::pause_reading | ( | connection_hdl | hdl, |
lib::error_code & | ec | ||
) |
Pause reading of new data (exception free)
Signals to the connection to halt reading of new data. While reading is paused, the connection will stop reading from its associated socket. In turn this will result in TCP based flow control kicking in and slowing data flow from the remote endpoint.
This is useful for applications that push new requests to a queue to be processed by another thread and need a way to signal when their request queue is full without blocking the network processing thread.
Use resume_reading()
to resume.
If supported by the transport this is done asynchronously. As such reading may not stop until the current read operation completes. Typically you can expect to receive no more bytes after initiating a read pause than the size of the read buffer.
If reading is paused for this connection already nothing is changed.
Definition at line 114 of file endpoint_impl.hpp.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::pause_reading | ( | connection_hdl | hdl | ) |
Pause reading of new data.
Definition at line 123 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::resume_reading | ( | connection_hdl | hdl, |
lib::error_code & | ec | ||
) |
Resume reading of new data (exception free)
Signals to the connection to resume reading of new data after it was paused by pause_reading()
.
If reading is not paused for this connection already nothing is changed.
Definition at line 130 of file endpoint_impl.hpp.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::resume_reading | ( | connection_hdl | hdl | ) |
Resume reading of new data.
Definition at line 139 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send_http_response | ( | connection_hdl | hdl, |
lib::error_code & | ec | ||
) |
Send deferred HTTP Response.
Sends an http response to an HTTP connection that was deferred. This will send a complete response including all headers, status line, and body text. The connection will be closed afterwards.
Exception free variant
hdl | The connection to send the response on |
ec | A status code, zero on success, non-zero otherwise |
Definition at line 146 of file endpoint_impl.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), and websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::send_http_response | ( | connection_hdl | hdl | ) |
Send deferred HTTP Response (exception free)
Sends an http response to an HTTP connection that was deferred. This will send a complete response including all headers, status line, and body text. The connection will be closed afterwards.
Exception variant
hdl | The connection to send the response on |
Definition at line 155 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
std::string const & | payload, | ||
frame::opcode::value | op, | ||
lib::error_code & | ec | ||
) |
Create a message and add it to the outgoing send queue (exception free)
Convenience method to send a message given a payload string and an opcode
[in] | hdl | The handle identifying the connection to send via. |
[in] | payload | The payload string to generated the message with |
[in] | op | The opcode to generated the message with. |
[out] | ec | A code to fill in for errors |
Definition at line 162 of file endpoint_impl.hpp.
Referenced by count_server::count(), echo_func(), utility_server::echo_handler(), broadcast_server::on_message(), on_message(), on_open(), perftest::on_open(), telemetry_server::on_timer(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size(), telemetry_client::telemetry_loop(), validate_func(), and nfd::face::WebSocketTransport::WebSocketTransport().
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
std::string const & | payload, | ||
frame::opcode::value | op | ||
) |
Create a message and add it to the outgoing send queue.
Convenience method to send a message given a payload string and an opcode
[in] | hdl | The handle identifying the connection to send via. |
[in] | payload | The payload string to generated the message with |
[in] | op | The opcode to generated the message with. |
[out] | ec | A code to fill in for errors |
Definition at line 172 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
void const * | payload, | ||
size_t | len, | ||
frame::opcode::value | op, | ||
lib::error_code & | ec | ||
) |
Definition at line 181 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
void const * | payload, | ||
size_t | len, | ||
frame::opcode::value | op | ||
) |
Definition at line 190 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
message_ptr | msg, | ||
lib::error_code & | ec | ||
) |
Definition at line 199 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl, |
message_ptr | msg | ||
) |
Definition at line 208 of file endpoint_impl.hpp.
void websocketpp::endpoint< connection, config >::close | ( | connection_hdl | hdl, |
close::status::value const | code, | ||
std::string const & | reason, | ||
lib::error_code & | ec | ||
) |
Definition at line 215 of file endpoint_impl.hpp.
Referenced by nfd::face::WebSocketTransport::doClose(), perftest::on_message(), and websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::close | ( | connection_hdl | hdl, |
close::status::value const | code, | ||
std::string const & | reason | ||
) |
Definition at line 225 of file endpoint_impl.hpp.
References close().
void websocketpp::endpoint< connection, config >::ping | ( | connection_hdl | hdl, |
std::string const & | payload, | ||
lib::error_code & | ec | ||
) |
Send a ping to a specific connection.
[in] | hdl | The connection_hdl of the connection to send to. |
[in] | payload | The payload string to send. |
[out] | ec | A reference to an error code to fill in |
Definition at line 234 of file endpoint_impl.hpp.
Referenced by nfd::face::WebSocketTransport::receiveMessage(), and websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::ping | ( | connection_hdl | hdl, |
std::string const & | payload | ||
) |
Send a ping to a specific connection.
Exception variant of ping
[in] | hdl | The connection_hdl of the connection to send to. |
[in] | payload | The payload string to send. |
Definition at line 243 of file endpoint_impl.hpp.
References websocketpp::frame::opcode::ping.
void websocketpp::endpoint< connection, config >::pong | ( | connection_hdl | hdl, |
std::string const & | payload, | ||
lib::error_code & | ec | ||
) |
Send a pong to a specific connection.
[in] | hdl | The connection_hdl of the connection to send to. |
[in] | payload | The payload string to send. |
[out] | ec | A reference to an error code to fill in |
Definition at line 251 of file endpoint_impl.hpp.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_max_http_body_size().
void websocketpp::endpoint< connection, config >::pong | ( | connection_hdl | hdl, |
std::string const & | payload | ||
) |
Send a pong to a specific connection.
Exception variant of pong
[in] | hdl | The connection_hdl of the connection to send to. |
[in] | payload | The payload string to send. |
Definition at line 260 of file endpoint_impl.hpp.
References websocketpp::frame::opcode::pong.
|
inline |
Retrieves a connection_ptr from a connection_hdl (exception free)
Converting a weak pointer to shared_ptr is not thread safe because the pointer could be deleted at any time.
NOTE: This method may be called by handler to upgrade its handle to a full connection_ptr. That full connection may then be used safely for the remainder of the handler body. get_con_from_hdl and the resulting connection_ptr are NOT safe to use outside the handler loop.
hdl | The connection handle to translate |
Definition at line 643 of file endpoint.hpp.
Referenced by check_on_fail(), default_on_msg(), defer_http_func(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::get_con_from_hdl(), http_func(), connection_metadata::on_close(), connection_metadata::on_fail(), perftest::on_fail(), on_fail(), on_http(), telemetry_server::on_http(), on_message(), connection_metadata::on_open(), on_open_print(), open_func_subprotocol(), stop_on_close(), validate(), validate_func_subprotocol(), validate_set_ua(), nfd::face::WebSocketChannel::WebSocketChannel(), and nfd::face::WebSocketTransport::WebSocketTransport().
|
inline |
Retrieves a connection_ptr from a connection_hdl (exception version)
Definition at line 653 of file endpoint.hpp.
|
protected |
Definition at line 37 of file endpoint_impl.hpp.
References websocketpp::log::alevel::devel, websocketpp::log::elevel::fatal, websocketpp::session::http_state::init, websocketpp::config::core_client::max_message_size, config::timeout_close_handshake, config::timeout_open_handshake, and config::timeout_pong.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::get_con_from_hdl(), websocketpp::client< websocketpp::config::asio_client >::get_connection(), and websocketpp::server< websocketpp::config::asio >::get_connection().
|
protected |
Definition at line 664 of file endpoint.hpp.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::clear_access_channels(), websocketpp::client< websocketpp::config::asio_client >::client(), websocketpp::client< websocketpp::config::asio_client >::connect(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::endpoint(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::get_alog(), websocketpp::server< websocketpp::config::asio >::server(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_access_channels(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_close_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_fail_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_http_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_interrupt_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_message_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_open_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_ping_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_pong_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_pong_timeout_handler(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_validate_handler(), and websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::~endpoint().
|
protected |
Definition at line 665 of file endpoint.hpp.
Referenced by websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::clear_error_channels(), websocketpp::client< websocketpp::config::asio_client >::connect(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::endpoint(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::get_elog(), websocketpp::server< websocketpp::config::asio >::handle_accept(), websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::set_error_channels(), and websocketpp::endpoint< connection< websocketpp::config::asio >, websocketpp::config::asio >::~endpoint().