![]() |
Cadabra
Computer algebra system for field theory problems
|
#include <websocket_server.hh>
Classes | |
| class | connection |
Public Types | |
| using | id_type = std::size_t |
| using | request_type = boost::beast::http::request< boost::beast::http::string_body > |
| using | response_type = boost::beast::http::response< boost::beast::http::string_body > |
| using | message_handler = std::function< void(id_type, const std::string &, const request_type &, const std::string &ip_address)> |
| using | connect_handler = std::function< void(id_type)> |
| using | disconnect_handler = std::function< void(id_type)> |
| using | http_handler = std::function< void(request_type &, response_type &)> |
Public Member Functions | |
| websocket_server ()=default | |
| websocket_server (uint16_t port) | |
| ~websocket_server () | |
| websocket_server (const websocket_server &)=delete | |
| websocket_server & | operator= (const websocket_server &)=delete |
| void | listen (uint16_t port) |
| void | set_message_handler (message_handler h) |
| void | set_connect_handler (connect_handler h) |
| void | set_disconnect_handler (disconnect_handler h) |
| void | set_http_handler (http_handler h) |
| void | run () |
| void | stop () |
| void | send (id_type id, const std::string &message) |
| void | close (id_type id) |
| uint16_t | get_local_port () const |
Private Member Functions | |
| void | do_accept () |
| void | remove_connection (id_type id) |
Private Attributes | |
| boost::asio::io_context | ioc_ |
| std::optional< boost::asio::ip::tcp::acceptor > | acceptor_ |
| std::unordered_map< id_type, std::shared_ptr< connection > > | connections_ |
| id_type | next_connection_id_ {0} |
| message_handler | message_handler_ |
| connect_handler | connect_handler_ |
| disconnect_handler | disconnect_handler_ |
| http_handler | http_handler_ |
| using websocket_server::connect_handler = std::function<void(id_type)> |
| using websocket_server::disconnect_handler = std::function<void(id_type)> |
| using websocket_server::http_handler = std::function<void(request_type&, response_type&)> |
| using websocket_server::id_type = std::size_t |
| using websocket_server::message_handler = std::function<void(id_type, const std::string&, const request_type&, const std::string& ip_address)> |
| using websocket_server::request_type = boost::beast::http::request<boost::beast::http::string_body> |
| using websocket_server::response_type = boost::beast::http::response<boost::beast::http::string_body> |
|
default |
|
explicit |
| websocket_server::~websocket_server | ( | ) |
|
delete |
| void websocket_server::close | ( | id_type | id | ) |
|
private |
| uint16_t websocket_server::get_local_port | ( | ) | const |
| void websocket_server::listen | ( | uint16_t | port | ) |
|
delete |
|
private |
| void websocket_server::run | ( | ) |
| void websocket_server::send | ( | id_type | id, |
| const std::string & | message | ||
| ) |
| void websocket_server::set_connect_handler | ( | connect_handler | h | ) |
| void websocket_server::set_disconnect_handler | ( | disconnect_handler | h | ) |
| void websocket_server::set_http_handler | ( | http_handler | h | ) |
| void websocket_server::set_message_handler | ( | message_handler | h | ) |
| void websocket_server::stop | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |