void on_read( boost::system::error_code ec, std::size_t bytes_transferred) { boost::ignore_unused(bytes_transferred); // This indicates that the session was closed if(ec == websocket::error::closed) return; if(ec) fail(ec, "read"); // Echo the message ws_.text(ws_.got_text()); ws_.async_write( buffer_.data(), boost::asio::bind_executor( strand_, std::bind( &session::on_write, shared_from_this(), std::placeholders::_1, std::placeholders::_2))); }