forked from boostorg/beast
Rename to multi_buffer, basic_multi_buffer (API Change):
These classes are renamed: * streambuf to multi_buffer * basic_streambuf to basic_multi_buffer
This commit is contained in:
@@ -45,17 +45,17 @@ int main()
|
||||
beast::http::write(sock, req);
|
||||
|
||||
// Receive and print HTTP response using beast
|
||||
beast::streambuf sb;
|
||||
beast::http::response<beast::http::dynamic_body> resp;
|
||||
beast::http::read(sock, sb, resp);
|
||||
std::cout << resp;
|
||||
beast::multi_buffer b;
|
||||
beast::http::response<beast::http::dynamic_body> res;
|
||||
beast::http::read(sock, b, res);
|
||||
std::cout << res;
|
||||
}
|
||||
```
|
||||
[heading WebSocket]
|
||||
|
||||
Establish a WebSocket connection, send a message and receive the reply:
|
||||
```
|
||||
#include <beast/core/to_string.hpp>
|
||||
#include <beast/core.hpp>
|
||||
#include <beast/websocket.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
@@ -77,11 +77,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