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

Method do_accept

example/advanced/server/advanced_server.cpp:234–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 // Start the asynchronous accept operation
233 template<class Body, class Allocator>
234 void
235 do_accept(http::request<Body, http::basic_fields<Allocator>> req)
236 {
237 // Set suggested timeout settings for the websocket
238 ws_.set_option(
239 websocket::stream_base::timeout::suggested(
240 beast::role_type::server));
241
242 // Set a decorator to change the Server of the handshake
243 ws_.set_option(websocket::stream_base::decorator(
244 [](websocket::response_type& res)
245 {
246 res.set(http::field::server,
247 std::string(BOOST_BEAST_VERSION_STRING) +
248 " advanced-server");
249 }));
250
251 // Accept the websocket handshake
252 ws_.async_accept(
253 req,
254 beast::bind_front_handler(
255 &websocket_session::on_accept,
256 shared_from_this()));
257 }
258
259private:
260 void

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