MCPcopy Create free account
hub / github.com/boostorg/beast / on_run

Method on_run

example/websocket/server/async/websocket_server_async.cpp:73–94  ·  view source on GitHub ↗

Start the asynchronous operation

Source from the content-addressed store, hash-verified

71
72 // Start the asynchronous operation
73 void
74 on_run()
75 {
76 // Set suggested timeout settings for the websocket
77 ws_.set_option(
78 websocket::stream_base::timeout::suggested(
79 beast::role_type::server));
80
81 // Set a decorator to change the Server of the handshake
82 ws_.set_option(websocket::stream_base::decorator(
83 [](websocket::response_type& res)
84 {
85 res.set(http::field::server,
86 std::string(BOOST_BEAST_VERSION_STRING) +
87 " websocket-server-async");
88 }));
89 // Accept the websocket handshake
90 ws_.async_accept(
91 beast::bind_front_handler(
92 &session::on_accept,
93 shared_from_this()));
94 }
95
96 void
97 on_accept(beast::error_code ec)

Callers

nothing calls this directly

Calls 3

bind_front_handlerFunction · 0.85
set_optionMethod · 0.80
decoratorClass · 0.50

Tested by

no test coverage detected