void do_sync() { try { ws_.accept(); for(;;) { ws_.read(buffer_); ws_.text(ws_.got_text()); ws_.write(buffer_.data()); buffer_.consume(buffer_.size()); } } catch(system_error const& se) { boost::ignore_unused(se); #if 0 if( se.code() != error::closed && se.code() != error::failed && se.code() != boost::asio::error::eof) log_ << "ws_echo_server: " << se.code().message() << std::endl; #endif } catch(std::exception const& e) { log_ << "ws_echo_server: " << e.what() << std::endl; } }
void on_write(error_code ec) { if(ec) return fail(ec); buffer_.consume(buffer_.size()); do_read(); }