dumheter / uWebSockets

Tiny WebSockets

Home Page:https://gitter.im/uWebSockets-chat/Lobby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

µWS ("microWS") is a WebSocket and HTTP implementation for clients and servers. Simple, efficient and lightweight.

Wiki pages & user manual

Build optimized WebSocket & HTTP servers & clients in no time.

#include <uWS/uWS.h>
using namespace uWS;

int main() {
    Hub h;
    std::string response = "Hello!";

    h.onMessage([](WebSocket<SERVER> *ws, char *message, size_t length, OpCode opCode) {
        ws->send(message, length, opCode);
    });

    h.onHttpRequest([&](HttpResponse *res, HttpRequest req, char *data, size_t length,
                        size_t remainingBytes) {
        res->end(response.data(), response.length());
    });

    if (h.listen(3000)) {
        h.run();
    }
}

No strings attached.

A free & open source (Zlib) hobby project of mine since 2016. Kindly sponsored by BitMEX.com since 2018.

Excel across the board.

Fast does not imply broken.

Gracefully passes the entire Autobahn fuzzing test suite with no failures or Valgrind/ASAN errors. With or without SSL/permessage-deflate.

About

Tiny WebSockets

https://gitter.im/uWebSockets-chat/Lobby

License:zlib License


Languages

Language:C++ 97.4%Language:Makefile 1.5%Language:Go 0.5%Language:QMake 0.4%Language:JavaScript 0.2%Language:Shell 0.0%