| 26 | #include "websocket_common.ipp" |
| 27 | |
| 28 | void |
| 29 | snippets() |
| 30 | { |
| 31 | stream<tcp_stream> ws(ioc); |
| 32 | |
| 33 | { |
| 34 | //[code_websocket_8_1 |
| 35 | |
| 36 | flat_buffer buffer; |
| 37 | |
| 38 | ws.async_read(buffer, |
| 39 | [](error_code, std::size_t) |
| 40 | { |
| 41 | // Do something with the buffer |
| 42 | }); |
| 43 | |
| 44 | //] |
| 45 | } |
| 46 | |
| 47 | multi_buffer b; |
| 48 | |
| 49 | { |
| 50 | //[code_websocket_8_2 |
| 51 | |
| 52 | ws.async_read(b, [](error_code, std::size_t){}); |
| 53 | ws.async_read(b, [](error_code, std::size_t){}); |
| 54 | |
| 55 | //] |
| 56 | } |
| 57 | |
| 58 | { |
| 59 | //[code_websocket_8_3 |
| 60 | |
| 61 | ws.async_read(b, [](error_code, std::size_t){}); |
| 62 | ws.async_write(b.data(), [](error_code, std::size_t){}); |
| 63 | ws.async_ping({}, [](error_code){}); |
| 64 | ws.async_close({}, [](error_code){}); |
| 65 | |
| 66 | //] |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // workaround for https://github.com/chriskohlhoff/asio/issues/112 |
| 71 | //#ifdef BOOST_MSVC |
nothing calls this directly
no test coverage detected