137 {
138
140
141 try {
142
145
146
147 echo_server.init_asio();
148 echo_server.set_reuse_addr(true);
149
150
152
156
158
159
160 echo_server.listen(9012);
161
162
164
165
166 echo_server.run();
167 } catch (const std::exception & e) {
168 std::cout << e.what() << std::endl;
169 } catch (websocketpp::lib::error_code e) {
170 std::cout << e.message() << std::endl;
171 } catch (...) {
172 std::cout << "other exception" << std::endl;
173 }
174}
void set_fail_handler(fail_handler h)
void set_message_handler(message_handler h)
void clear_access_channels(log::level channels)
Clear Access logging channels.
void set_http_handler(http_handler h)
void set_access_channels(log::level channels)
Set Access logging channel.
void set_close_handler(close_handler h)
void set_validate_handler(validate_handler h)
void start_accept(lib::error_code &ec)
Starts the server's async connection acceptance loop (exception free)
void on_fail(server *s, websocketpp::connection_hdl hdl)
bool validate(server *, websocketpp::connection_hdl)
void on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg)
void on_close(websocketpp::connection_hdl)
void on_http(server *s, websocketpp::connection_hdl hdl)
static level const all
Special aggregate value representing "all levels".
static level const frame_payload
One line per frame, includes the full message payload (warning: chatty)