Definition at line 19 of file associative_storage.cpp.
◆ print_server() [1/2]
print_server::print_server |
( |
| ) |
|
|
inline |
Definition at line 21 of file associative_storage.cpp.
21 : m_next_sessionid(1) {
22 m_server.init_asio();
23
27 }
void on_message(connection_hdl hdl, server::message_ptr msg)
void on_close(connection_hdl hdl)
void on_open(connection_hdl hdl)
void set_message_handler(message_handler h)
void set_open_handler(open_handler h)
void set_close_handler(close_handler h)
◆ print_server() [2/2]
print_server::print_server |
( |
| ) |
|
|
inline |
Definition at line 40 of file enriched_storage.cpp.
40 : m_next_sessionid(1) {
41 m_server.init_asio();
42
46 }
◆ get_data_from_hdl()
Definition at line 60 of file associative_storage.cpp.
60 {
61 auto it = m_connections.find(hdl);
62
63 if (it == m_connections.end()) {
64
65
66 throw std::invalid_argument("No data available for session");
67 }
68
69 return it->second;
70 }
◆ on_close() [1/2]
Definition at line 38 of file associative_storage.cpp.
38 {
40
41 std::cout << "Closing connection " << data.name
42 << " with sessionid " << data.sessionid << std::endl;
43
44 m_connections.erase(hdl);
45 }
connection_data & get_data_from_hdl(connection_hdl hdl)
◆ on_close() [2/2]
Definition at line 54 of file enriched_storage.cpp.
54 {
56
57 std::cout << "Closing connection " << con->name
58 << " with sessionid " << con->sessionid << std::endl;
59 }
connection_ptr get_con_from_hdl(connection_hdl hdl, lib::error_code &ec)
Retrieves a connection_ptr from a connection_hdl (exception free)
client::connection_ptr connection_ptr
◆ on_message() [1/2]
Definition at line 47 of file associative_storage.cpp.
47 {
49
50 if (data.name.empty()) {
51 data.name = msg->get_payload();
52 std::cout << "Setting name of connection with sessionid "
53 << data.sessionid << " to " << data.name << std::endl;
54 } else {
55 std::cout << "Got a message from connection " << data.name
56 << " with sessionid " << data.sessionid << std::endl;
57 }
58 }
◆ on_message() [2/2]
Definition at line 61 of file enriched_storage.cpp.
61 {
63
64 if (con->name.empty()) {
65 con->name = msg->get_payload();
66 std::cout << "Setting name of connection with sessionid "
67 << con->sessionid << " to " << con->name << std::endl;
68 } else {
69 std::cout << "Got a message from connection " << con->name
70 << " with sessionid " << con->sessionid << std::endl;
71 }
72 }
◆ on_open() [1/2]
◆ on_open() [2/2]
◆ run() [1/2]
Definition at line 72 of file associative_storage.cpp.
72 {
73 m_server.listen(port);
75 m_server.run();
76 }
void start_accept(lib::error_code &ec)
Starts the server's async connection acceptance loop (exception free)
◆ run() [2/2]
The documentation for this class was generated from the following files: