From fc0084cdc49fc5b979b6ea1a5d234ae9670db3c5 Mon Sep 17 00:00:00 2001 From: Alex Hultman <3397140+alexhultman@users.noreply.github.com> Date: Wed, 20 Jun 2018 22:31:16 +0200 Subject: [PATCH] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a37dd46..ecfea9c 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,16 @@ v0.15 is a complete rewrite of µWS using µSockets as foundation. This leads to #### Streams and helpers HttpSockets are proper streams in v0.15 and do scale for large sends as well as for small ones. "Streams" are in/out per-socket-callbacks for giving or storing streamed data. ```c++ -uWS::defaultHub.onHttpRequest([buffer](HttpSocket *s, HttpRequest *req) { +// Seamless swapping between SSL / non-SSL by using uWS::Context() instead! +uWS::SSLContext(options).onHttpRequest([buffer](auto *s, HttpRequest *req) { if (req->getUrl() == "/") { - s->writeStatus(200)->writeHeader("Server", "µWebSockets v0.15")->end(buffer, 512); + s->writeStatus(200)->writeHeader("Hello", "World")->end(buffer, 512); } else { std::cout << "Got HTTP request at URL: " << req->getUrl() << std::endl; } -}).listen("localhost", 3000, 0).run(); +}).listen("localhost", 3000, 0); ``` #### HTTP router helpers