From bc13b10461c03d7297bd03524d679b3656c82206 Mon Sep 17 00:00:00 2001 From: Alex Hultman <3397140+alexhultman@users.noreply.github.com> Date: Fri, 5 Oct 2018 00:14:06 +0200 Subject: [PATCH] Update README.md --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a885cfb..dd592e0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
-*µWS ("[micro](https://en.wikipedia.org/wiki/Micro-)WS") is simple and efficient[[1]](benchmarks) messaging for the modern web.* +*µWS ("[micro](https://en.wikipedia.org/wiki/Micro-)WS") is simple and efficient*[[1]](benchmarks) *messaging for the modern web.* • [Fancy pants details, user manual and FAQ](misc/READMORE.md) @@ -10,25 +10,28 @@ #### Express yourself briefly. ```c++ uWS::SSLApp({ + + /* There are tons of SSL options */ .cert_file_name = "cert.pem", .key_file_name = "key.pem" -}).onGet("/", [](auto *res, auto *req, auto *args) { + +}).onGet("/", [](auto *res, auto *req) { /* Respond with the web app on default route */ res->writeStatus("200 OK") ->writeHeader("Content-Type", "text/html; charset=utf-8") ->end(indexHtmlBuffer); -}).onWebSocket("/ws/chat", [&](auto *ws, auto *req, auto *args) { +}).onWebSocket("/ws/chat", [&](auto *ws, auto *req) { /* Subscribe to topic /chat */ - ws->subscribe("/chat"); + ws->subscribe("chat"); }).onMessage([&](auto *ws, auto message, auto opCode) { /* Parse incoming message according to some protocol & publish it */ if (seemsReasonable(message)) { - ws->publish("/chat", message); + ws->publish("chat", message); } else { ws->close(); } @@ -36,7 +39,7 @@ uWS::SSLApp({ }).onClose([&](auto *ws, int code, auto message) { /* Remove websocket from this topic */ - ws->unsubscribe("/chat"); + ws->unsubscribe("chat"); }).listen("localhost", 3000, 0).run(); ```