mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
@ -6,6 +6,7 @@ Version 44
|
||||
* Tidy up and make get_lowest_layer public
|
||||
* Use BOOST_STATIC_ASSERT
|
||||
* Fix async return values in docs
|
||||
* Fix README websocket example
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -156,7 +156,7 @@ and run yourself (they are in the `examples` directory).
|
||||
|
||||
Example WebSocket program:
|
||||
```C++
|
||||
#include <beast/core/to_string.hpp>
|
||||
#include <beast/core.hpp>
|
||||
#include <beast/websocket.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
@ -178,11 +178,11 @@ int main()
|
||||
ws.write(boost::asio::buffer(std::string("Hello, world!")));
|
||||
|
||||
// Receive WebSocket message, print and close using beast
|
||||
beast::streambuf sb;
|
||||
beast::multi_buffer b;
|
||||
beast::websocket::opcode op;
|
||||
ws.read(op, sb);
|
||||
ws.read(op, b);
|
||||
ws.close(beast::websocket::close_code::normal);
|
||||
std::cout << beast::to_string(sb.data()) << "\n";
|
||||
std::cout << beast::buffers(b.data()) << "\n";
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user