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

Method on_read

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

Source from the content-addressed store, hash-verified

115 }
116
117 void
118 on_read(
119 beast::error_code ec,
120 std::size_t bytes_transferred)
121 {
122 boost::ignore_unused(bytes_transferred);
123
124 // This indicates that the session was closed
125 if(ec == websocket::error::closed)
126 return;
127
128 if(ec)
129 return fail(ec, "read");
130
131 // Echo the message
132 ws_.text(ws_.got_text());
133 ws_.async_write(
134 buffer_.data(),
135 beast::bind_front_handler(
136 &session::on_write,
137 shared_from_this()));
138 }
139
140 void
141 on_write(

Callers

nothing calls this directly

Calls 4

bind_front_handlerFunction · 0.85
textMethod · 0.80
failFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected