Server endpoint role based on the given config. More...
#include <server_endpoint.hpp>
Public Types | |
typedef server< config > | type |
Type of this endpoint. More... | |
typedef config::concurrency_type | concurrency_type |
Type of the endpoint concurrency component. More... | |
typedef config::transport_type | transport_type |
Type of the endpoint transport component. More... | |
typedef connection< config > | connection_type |
Type of the connections this server will create. More... | |
typedef connection_type::ptr | connection_ptr |
Type of a shared pointer to the connections this server will create. More... | |
typedef transport_type::transport_con_type | transport_con_type |
Type of the connection transport component. More... | |
typedef transport_con_type::ptr | transport_con_ptr |
Type of a shared pointer to the connection transport component. More... | |
typedef endpoint< connection_type, config > | endpoint_type |
Type of the endpoint component of this server. More... | |
Public Types inherited from websocketpp::endpoint< connection< config >, config > | |
typedef endpoint< connection< config >, 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< config > | 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... | |
typedef lib::function< lib::error_code(acceptor_ptr)> | tcp_pre_bind_handler |
Type of socket pre-bind handler. 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 | |
server () | |
~server () | |
Destructor. More... | |
connection_ptr | get_connection () |
Create and initialize a new connection. More... | |
void | start_accept (lib::error_code &ec) |
Starts the server's async connection acceptance loop (exception free) More... | |
void | start_accept () |
Starts the server's async connection acceptance loop. More... | |
void | handle_accept (connection_ptr con, lib::error_code const &ec) |
Handler callback for start_accept. More... | |
Public Member Functions inherited from websocketpp::endpoint< connection< config >, config > | |
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_bind_handler (tcp_pre_bind_handler h) |
Sets the tcp pre bind handler. 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... | |
Friends | |
class | connection< config > |
Additional Inherited Members | |
Protected Member Functions inherited from websocketpp::endpoint< connection< config >, config > | |
connection_ptr | create_connection () |
Protected Member Functions inherited from websocketpp::transport::asio::endpoint< config > | |
void | init_logging (const lib::shared_ptr< alog_type > &a, const lib::shared_ptr< 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 inherited from websocketpp::endpoint< connection< config >, config > | |
lib::shared_ptr< alog_type > | m_alog |
lib::shared_ptr< elog_type > | m_elog |
Server endpoint role based on the given config.
Definition at line 44 of file server_endpoint.hpp.
typedef server<config> websocketpp::server< config >::type |
Type of this endpoint.
Definition at line 47 of file server_endpoint.hpp.
typedef config::concurrency_type websocketpp::server< config >::concurrency_type |
Type of the endpoint concurrency component.
Definition at line 50 of file server_endpoint.hpp.
typedef config::transport_type websocketpp::server< config >::transport_type |
Type of the endpoint transport component.
Definition at line 52 of file server_endpoint.hpp.
typedef connection<config> websocketpp::server< config >::connection_type |
Type of the connections this server will create.
Definition at line 55 of file server_endpoint.hpp.
typedef connection_type::ptr websocketpp::server< config >::connection_ptr |
Type of a shared pointer to the connections this server will create.
Definition at line 57 of file server_endpoint.hpp.
typedef transport_type::transport_con_type websocketpp::server< config >::transport_con_type |
Type of the connection transport component.
Definition at line 60 of file server_endpoint.hpp.
typedef transport_con_type::ptr websocketpp::server< config >::transport_con_ptr |
Type of a shared pointer to the connection transport component.
Definition at line 62 of file server_endpoint.hpp.
typedef endpoint<connection_type,config> websocketpp::server< config >::endpoint_type |
Type of the endpoint component of this server.
Definition at line 65 of file server_endpoint.hpp.
|
inlineexplicit |
Definition at line 69 of file server_endpoint.hpp.
|
inline |
Destructor.
Definition at line 75 of file server_endpoint.hpp.
|
inline |
Create and initialize a new connection.
The connection will be initialized and ready to begin. Call its start() method to begin the processing loop.
Note: The connection must either be started or terminated using connection::terminate in order to avoid memory leaks.
Definition at line 106 of file server_endpoint.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), main(), run_server_test(), and websocketpp::server< websocketpp::config::asio >::start_accept().
|
inline |
Starts the server's async connection acceptance loop (exception free)
Initiates the server connection acceptance loop. Must be called after listen. This method will have no effect until the underlying io_service starts running. It may be called after the io_service is already running.
Refer to documentation for the transport policy you are using for instructions on how to stop this acceptance loop.
[out] | ec | A status code indicating an error, if any. |
Definition at line 121 of file server_endpoint.hpp.
Referenced by nfd::face::WebSocketChannel::listen(), main(), broadcast_server::run(), count_server::run(), utility_server::run(), telemetry_server::run(), and run_server().
|
inline |
Starts the server's async connection acceptance loop.
Initiates the server connection acceptance loop. Must be called after listen. This method will have no effect until the underlying io_service starts running. It may be called after the io_service is already running.
Refer to documentation for the transport policy you are using for instructions on how to stop this acceptance loop.
Definition at line 157 of file server_endpoint.hpp.
Referenced by websocketpp::server< websocketpp::config::asio >::handle_accept(), and websocketpp::server< websocketpp::config::asio >::start_accept().
|
inline |
Handler callback for start_accept.
Definition at line 166 of file server_endpoint.hpp.
|
friend |
Definition at line 67 of file server_endpoint.hpp.