uWebSockets
Simple, secure & standards compliant web server for the most demanding of a...
README
Simple, secure1 & standards compliant2 web server for the most demanding3 of applications. Read more...
:closed_lock_with_key: Optimized security
:arrow_forward: Rapid scripting
Besides this Node.js integration, you can also use Bun where µWebSockets is the built-in web server.
:crossed_swords: Battle proven
:battery: Batteries included
Designed around a convenient URL router with wildcard & parameter support - paired with efficient pub/sub features for WebSockets. µWebSockets should be the obvious, complete starting point for any real-time web project with high demands.
- ```c++
- uWS::SSLApp({
- /* These are the most common options, fullchain and key. See uSockets for more options. */
- .cert_file_name = "cert.pem",
- .key_file_name = "key.pem"
- }).get("/hello", [](auto *res, auto *req) {
- /* You can efficiently stream huge files too */
- res->writeHeader("Content-Type", "text/html; charset=utf-8")->end("Hello HTTP!");
- }).ws<UserData>("/*", {
- /* Just a few of the available handlers */
- .open = [](auto *ws) {
- ws->subscribe("oh_interesting_subject");
- },
- .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
- ws->send(message, opCode);
- }
- }).listen(9001, [](auto *listenSocket) {
- if (listenSocket) {
- std::cout << "Listening on port " << 9001 << std::endl;
- } else {
- std::cout << "Failed to load certs or to bind to port" << std::endl;
- }
- }).run();
- ```
:briefcase: Commercially supported
Special thanks to BitMEX, Bitfinex, Google, Coinbase, Bitwyre, AppDrag and deepstreamHub for allowing the project itself to thrive on GitHub since 2016 - this project would not be possible without these beautiful companies.
:wrench: Customizable architecture
In a nutshell:
WITH_WOLFSSL=1 WITH_LIBUV=1 make examples builds examples utilizing WolfSSL and libuv
WITH_OPENSSL=1 make examples builds examples utilizing OpenSSL and the native kernel
See µSockets for an up-to-date list of flags and a more detailed explanation.
:handshake: Permissively licensed
Intellectual property, all rights reserved.
Where such explicit notice is given, source code is licensed Apache License 2.0 which is a permissive OSI-approved license with very few limitations. Modified "forks" should be of nothing but licensed source code, and be made available under another product name. If you're uncertain about any of this, please ask before assuming.