diff --git a/README.md b/README.md index 6486281..8b6b95d 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,54 @@ -
+
+ + +*µWS ("[micro](https://en.wikipedia.org/wiki/Micro-)WS") is simple and efficient message passing for the modern web.* +• [Fancy pants details & user manual](http://) -µWS ("[micro](https://en.wikipedia.org/wiki/Micro-)WS") is simple and efficient message passing for the modern web. +
-* Read the [fancy pants details & user manual](https://todo.sometime). - -#### Build optimized, standard web clients & servers in no time. +#### Time is of the essence. ```c++ uWS::App a; // or uWS::SSLApp(options) for SSL a.onGet("/", [](auto *s, auto *req, auto *args) { s->writeStatus("200 OK")->writeHeader("Hello", "World")->end(buffer); - + }).onGet("/largefile", [](auto *s, auto *req, auto *args) { s->write([](int offset) { - // stream chunks of the large file + return largeFile.substr(offset); }, fileSize); - + }).onPost("/upload/:filename", [](auto *s, auto *req, auto *args) { - s->read([std::string filename = args[0]](int offset, auto chunk) { - // stream chunks of data in to database with filename + s->read([std::ofstream fout = args[0]](int offset, auto chunk) { + fout << chunk; }); + +}).onWebSocket("/wsApi", [](auto *ws, auto *req, auto *args) { -}).onWebSocket("/wsApi", [](auto *protocol) { + std::cout << "WebSocket connected to /wsApi" << std::endl; + +}).onMessage([](auto *ws, auto message, auto opCode) { - protocol->onConnection([](auto *ws) { - - // store this websocket somewhere - - })->onMessage([](auto *ws, auto message, auto opCode) { - - ws->send(message, opCode); - - })->onDisconnection([]() { - - // remove this websocket - - }); + ws->send(message, opCode); + +}).onClose([](auto *ws, int code, auto message) { + std::cout << "WebSocket disconnected from /wsApi" << std::endl; + }).listen("localhost", 3000, 0); ``` -#### Deploy with confidence. -Feeling uncertain about your design? In need of professional help? Want to talk about the weather? I might have a few consulting hours for you and your business, send [me, the author](https://github.com/alexhultman) a mail and we'll figure out the rest. +#### In more than one way. +![](https://github.com/uNetworking/uWebSockets/raw/master/misc/images/overview.png) -#### Excel across the board. - - #### Pay what you want. A free & open source ([Zlib](LICENSE)) project since 2016. Kindly sponsored by [BitMEX](https://bitmex.com), [Bitfinex](https://bitfinex.com) & [Coinbase](https://www.coinbase.com/) in 2018.
-*Become a paying sponsor of the project to unlock support, issue reporting, roadmaps and to drop suggestions.* +*Become a paying sponsor to unlock support, issue reporting, roadmaps and to drop suggestions.* + +#### Stay confident. +If you're stuck, worried about design or just need help I might have a few consulting hours for you and your business. Throw [me, the author](https://github.com/alexhultman) a mail and we'll figure out the rest.