diff --git a/CHANGELOG.md b/CHANGELOG.md index 05cf22c6..04315bbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Fix handling of body_what::pause in basic_parser_v1 * Add headers_parser * Engaged invokable is destructible +* Improve websocket example in README.md API Changes: @@ -45,6 +46,7 @@ API Changes: * Relax ForwardIterator requirements in FieldSequence * Fix websocket failure testing * Refine Writer concept and fix exemplar in documentation +* Improve websocket example API Changes: diff --git a/README.md b/README.md index 38af4486..e5ae8bbb 100644 --- a/README.md +++ b/README.md @@ -171,14 +171,14 @@ int main() // WebSocket connect and send message using beast beast::websocket::stream ws{sock}; ws.handshake(host, "/"); - ws.write(boost::asio::buffer("Hello, world!")); + ws.write(boost::asio::buffer(std::string("Hello, world!"))); // Receive WebSocket message, print and close using beast beast::streambuf sb; beast::websocket::opcode op; ws.read(op, sb); ws.close(beast::websocket::close_code::normal); - std::cout << to_string(sb.data()) << "\n"; + std::cout << beast::to_string(sb.data()) << "\n"; } ``` diff --git a/examples/websocket_example.cpp b/examples/websocket_example.cpp index e9978d5a..1036e92c 100644 --- a/examples/websocket_example.cpp +++ b/examples/websocket_example.cpp @@ -24,12 +24,12 @@ int main() // WebSocket connect and send message using beast beast::websocket::stream ws{sock}; ws.handshake(host, "/"); - ws.write(boost::asio::buffer("Hello, world!")); + ws.write(boost::asio::buffer(std::string("Hello, world!"))); // Receive WebSocket message, print and close using beast beast::streambuf sb; beast::websocket::opcode op; ws.read(op, sb); ws.close(beast::websocket::close_code::normal); - std::cout << to_string(sb.data()) << "\n"; + std::cout << beast::to_string(sb.data()) << "\n"; }