README.md 1.42 KB
Newer Older
1
<div align="center"><img src="misc/images/logo.png"/></div>
Alex Hultman's avatar
Alex Hultman committed
2

Alex Hultman's avatar
Alex Hultman committed
3
µWS ("[micro](https://en.wikipedia.org/wiki/Micro-)WS") is a WebSocket and HTTP implementation for clients and servers. Simple, efficient and lightweight.
Alex Hultman's avatar
Alex Hultman committed
4

Alex Hultman's avatar
Alex Hultman committed
5
[Wiki pages & user manual](https://github.com/uNetworking/uWebSockets/wiki/User-manual-v0.14.x)
Alex Hultman's avatar
Alex Hultman committed
6

Alex Hultman's avatar
Alex Hultman committed
7
#### Build optimized WebSocket & HTTP servers & clients in no time.
Alex Hultman's avatar
Alex Hultman committed
8
```c++
Alex Hultman's avatar
Alex Hultman committed
9
#include <uWS/uWS.h>
Alex Hultman's avatar
Alex Hultman committed
10
using namespace uWS;
Alex Hultman's avatar
Alex Hultman committed
11

Alex Hultman's avatar
Alex Hultman committed
12
int main() {
Alex Hultman's avatar
Alex Hultman committed
13
14
    Hub h;
    std::string response = "Hello!";
Alex Hultman's avatar
Alex Hultman committed
15

Alex Hultman's avatar
Alex Hultman committed
16
    h.onMessage([](WebSocket<SERVER> *ws, char *message, size_t length, OpCode opCode) {
Alex Hultman's avatar
Alex Hultman committed
17
        ws->send(message, length, opCode);
Alex Hultman's avatar
Alex Hultman committed
18
19
    });

Alex Hultman's avatar
Alex Hultman committed
20
21
22
    h.onHttpRequest([&](HttpResponse *res, HttpRequest req, char *data, size_t length,
                        size_t remainingBytes) {
        res->end(response.data(), response.length());
Alex Hultman's avatar
Alex Hultman committed
23
24
    });

25
26
27
    if (h.listen(3000)) {
        h.run();
    }
Alex Hultman's avatar
Alex Hultman committed
28
29
}
```
30

Alex Hultman's avatar
Alex Hultman committed
31
#### Excel across the board.
32
<div align="center"><img src="misc/images/overview.png"/></div>
Alex Hultman's avatar
Alex Hultman committed
33

Alex Hultman's avatar
Alex Hultman committed
34
35
36
#### Fast does not imply broken.
Gracefully passes the [entire Autobahn fuzzing test suite](http://htmlpreview.github.io/?https://github.com/uNetworking/uWebSockets/blob/master/misc/autobahn/index.html) with no failures or Valgrind/ASAN errors. With or without SSL/permessage-deflate.

Alex Hultman's avatar
Alex Hultman committed
37
#### Freely available.
Alex Hultman's avatar
Alex Hultman committed
38
An open source ([Zlib](LICENSE)) hobby project of [mine](https://github.com/alexhultman) since 2016. Sponsored by [BitMEX.com](https://bitmex.com) since 2018.