| 80 | //------------------------------------------------------------------------------ |
| 81 | |
| 82 | void |
| 83 | do_sync_session(websocket::stream<beast::tcp_stream>& ws) |
| 84 | { |
| 85 | beast::error_code ec; |
| 86 | |
| 87 | setup_stream(ws); |
| 88 | |
| 89 | // Set a decorator to change the Server of the handshake |
| 90 | ws.set_option(websocket::stream_base::decorator( |
| 91 | [](websocket::response_type& res) |
| 92 | { |
| 93 | res.set(http::field::server, std::string( |
| 94 | BOOST_BEAST_VERSION_STRING) + "-Sync"); |
| 95 | })); |
| 96 | |
| 97 | ws.accept(ec); |
| 98 | if(ec) |
| 99 | return fail(ec, "accept"); |
| 100 | |
| 101 | for(;;) |
| 102 | { |
| 103 | beast::flat_buffer buffer; |
| 104 | |
| 105 | ws.read(buffer, ec); |
| 106 | if(ec == websocket::error::closed) |
| 107 | break; |
| 108 | if(ec) |
| 109 | return fail(ec, "read"); |
| 110 | ws.text(ws.got_text()); |
| 111 | ws.write(buffer.data(), ec); |
| 112 | if(ec) |
| 113 | return fail(ec, "write"); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void |
| 118 | do_sync_listen( |
nothing calls this directly
no test coverage detected