Simple, secure & standards compliant web server for the most demanding of applications

Overview

Simple, secure[1] & standards compliant[2] web server for the most demanding[3] of applications. Read more...

Language grade: C/C++



🔐 Optimized security

Being meticulously optimized for speed and memory footprint, µWebSockets is fast enough to do encrypted TLS 1.3 messaging quicker than most alternative servers can do even unencrypted, cleartext messaging[3].

Furthermore, we partake in Google's OSS-Fuzz with a ~95% daily fuzzing coverage with no sanitizer issues. LGTM scores us flawless A+ from having zero CodeQL alerts and we compile with pedantic warning levels.

▶️ Rapid scripting

µWebSockets is written entirely in C & C++ but has a seamless integration for Node.js backends. This allows for rapid scripting of powerful apps, using widespread competence. See µWebSockets.js.

⚔️ Battle proven

We've been fully standards compliant with a perfect Autobahn|Testsuite score since 2016[2]. Companies with everything to lose rely on µWebSockets on a daily basis - we power the trading APIs of Bitfinex.com & Kraken.com, handling volumes of multiple billions of USD every day. Other companies include Trello, where µWebSockets is serving their 50 million users with real-time board updates.

🔋 Batteries included

Designed around a convenient URL router with wildcard & parameter support - paired with efficient pub/sub features inspired by MQTT. µWebSockets should be the obvious, complete starting point for any real-time web project with high demands.

Start building your Http & WebSocket apps in a swift; read the user manual and see examples. You can browse our TypeDoc for a quick overview.

uWS::SSLApp({

    /* There are tons of SSL options, see uSockets */
    .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) {
        /* MQTT syntax */
        ws->subscribe("sensors/+/house");
    },
    .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;
    }
    
}).run();

💼 Commercially supported

uNetworking AB is a Swedish consulting & contracting company dealing with anything related to µWebSockets; development, support and customer success.

Don't hesitate sending a mail if you're building something large, in need of advice or having other business inquiries in mind. We'll figure out what's best for both parties and make sure you're not stepping into one of the many common pitfalls.

Special thanks to BitMEX, Bitfinex, Google, Coinbase, Bitwyre and deepstreamHub for allowing the project itself to thrive on GitHub since 2016 - this project would not be possible without these beautiful companies.

🔧 Customizable architecture

µWebSockets builds on µSockets, a foundation library implementing eventing, networking and cryptography in three different layers. Every layer has multiple implementations and you control the compiled composition with flags.

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.

🤝 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.

Comments
  • added more c apis and capi ssl version with capi examples

    added more c apis and capi ssl version with capi examples

    This adds a complete useful capi with ssl suport and most examples added.

    It's a step to solve this issue: https://github.com/uNetworking/uWebSockets/issues/1192 Opaque C interface for Swift, Rust, etc

    For now its just a wrapper and can be optimized a lot, but its a start.

    make capi, and make capi_examples for build added

    opened by cirospaciari 96
  • Segfault when connections are closing during publish()

    Segfault when connections are closing during publish()

    I am running into a situation where the library has a seg fault while trying to publish on the websockets. During the call to publish(), the library calls into drain(), which calls the cb() function of TopicTree. While executing that function, the segfault occurs because the Subscriber pointer is reset to UINTPTR_MAX.

    I could not cause this problem with a single client. The corner case is occurring when I have thousands of clients connected while publishing a large number of updates. As I end up overwhelming the clients, I see TCP retransmits and TCP windows reach 0. As the congestion occurs, some clients begin closing sockets. When this happens, TopicTree.h line 374 cb(min, intersectionCache[intersection] = std::move(res)); is eventually called with min set to UINTPTR_MAX. This then causes the seg fault in WebSocketContextData.h on line 61 auto *asyncSocket = (AsyncSocket<SSL> *) s->user; when trying to access the user.

    I've made two changes to workaround this, but am not sure if this is the best or proper solution.

    In WebSocketContextData.h, I added the if check on the subscriber pointer:

        WebSocketContextData() : topicTree([this](Subscriber *s, std::string_view data) -> int {
            /* We rely on writing to regular asyncSockets */
            if (s != (Subscriber *)UINTPTR_MAX) {
                auto *asyncSocket = (AsyncSocket<SSL> *) s->user;
    

    And in TopicTree.h in the drain() method around line 350, I added the additional code to decrement nonEmpty.

                        else {
                            /* We need to lower nextMin to us, in the case of min being the last in a set */
                            if ((it[i] != end[i]) && (nextMin > *it[i])) {
                                nextMin = *it[i];
                            } else if (min == (Subscriber *)UINTPTR_MAX) {
                                if (nonEmpty > 0) {
                                    nonEmpty--;
                                }
                            }
                        }
    
    

    Also the backtrace from gdb.

    (gdb) bt
    #0  0x00007f847a010837 in ioctl () from /lib64/libc.so.6
    #1  0x00007f847cb854bf in oo_resource_op (cmd=1074027035, io=0x7f84745ce65c, fp=<optimized out>) at ../../../../../src/include/onload/unix_intf.h:80
    #2  citp_signal_terminate (signum=<optimized out>, info=<optimized out>, context=<optimized out>) at ../../../../../src/lib/transport/ip/signal.c:280
    #3  0x00007f847cb85412 in citp_signal_run_app_handler ([email protected]=11, [email protected]=0x7f84745ce8f0, [email protected]=0x7f84745ce7c0) at ../../../../../src/lib/transport/ip/signal.c:106
    #4  0x00007f847cb8565a in citp_signal_run_now (our_info=<optimized out>, context=0x7f84745ce7c0, info=0x7f84745ce8f0, signum=11) at ../../../../../src/lib/transport/ip/signal.c:226
    #5  citp_signal_intercept (signum=11, info=0x7f84745ce8f0, context=0x7f84745ce7c0) at ../../../../../src/lib/transport/ip/signal.c:263
    #6  <signal handler called>
    #7  0x0000000000446f66 in std::_Function_handler<int (uWS::Subscriber*, std::basic_string_view<char, std::char_traits<char> >), uWS::WebSocketContextData<false>::WebSocketContextData()::{lambda(uWS::Subscriber*, std::basic_string_view<char, std::char_traits<char> >)#1}>::_M_invoke(std::_Any_data const&, uWS::Subscriber*&&, std::basic_string_view<char, std::char_traits<char> >&&) (__functor=...,
        __args#0=<optimized out>, __args#1=...) at /opt/x3p/xrt_b/base/lib/gcc/x86_64-unknown-linux/7/../../../../include/c++/7/bits/std_function.h:299
    #8  0x00000000004277e8 in std::function<int (uWS::Subscriber*, std::basic_string_view<char, std::char_traits<char> >)>::operator()(uWS::Subscriber*, std::basic_string_view<char, std::char_traits<char> >) const (__args#1="", __args#0=<optimized out>, this=0x1f4cd48) at /opt/x3p/xrt_b/base/lib/gcc/x86_64-unknown-linux/7/../../../../include/c++/7/bits/std_function.h:706
    #9  uWS::TopicTree::drain (this=0x1f4cd48) at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/TopicTree.h:374
    #10 0x0000000000411bd7 in fu2::abi_400::detail::type_erasure::tables::vtable<fu2::abi_400::detail::property<true, false, void (uWS::Loop*)> >::invoke<0ul, fu2::abi_400::detail::type_erasure::data_accessor*, unsigned long const&, uWS::Loop*>(fu2::abi_400::detail::type_erasure::data_accessor*&&, unsigned long const&, uWS::Loop*&&) const (this=0x1ec7df0)
        at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/f2/function2.hpp:995
    #11 fu2::abi_400::detail::type_erasure::erasure<true, fu2::abi_400::detail::config<true, false, fu2::capacity_default>, fu2::abi_400::detail::property<true, false, void (uWS::Loop*)> >::invoke<0ul, fu2::abi_400::detail::type_erasure::erasure<true, fu2::abi_400::detail::config<true, false, fu2::capacity_default>, fu2::abi_400::detail::property<true, false, void (uWS::Loop*)> >&, uWS::Loop*>(fu2::abi_400::detail::type_erasure::erasure<true, fu2::abi_400::detail::config<true, false, fu2::capacity_default>, fu2::abi_400::detail::property<true, false, void (uWS::Loop*)> >&, uWS::Loop*&&) (erasure=...)
        at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/f2/function2.hpp:1215
    #12 fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0ul, fu2::abi_400::detail::function<fu2::abi_400::detail::config<true, false, fu2::capacity_default>, fu2::abi_400::detail::property<true, false, void (uWS::Loop*)> >, void (uWS::Loop*)>::operator()(uWS::Loop*) (args#0=0x384e000, this=0x1ec7de0)
        at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/f2/function2.hpp:775
    #13 uWS::Loop::postCb (loop=0x384e000) at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/Loop.h:57
    #14 0x0000000000706a88 in us_loop_run (loop=0x384e000) at external/uSockets/src/eventing/epoll_kqueue.c:149
    #15 0x00000000004557e4 in uWS::Loop::run (this=<optimized out>) at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/Loop.h:152
    #16 uWS::run () at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/Loop.h:164
    #17 uWS::TemplatedApp<false>::run (this=<optimized out>) at bazel-out/k8-opt/bin/external/uWebSockets/_virtual_includes/uWebSockets/uWebSockets/App.h:334
    
    
    high priority bug v0.17 
    opened by tomwickert 36
  • Safari (macOS 12, iOS 15) and compression is broken

    Safari (macOS 12, iOS 15) and compression is broken

    All versions of uWS are totally incompatible with iOS 15 when using compression and will not keep a connection. This is because of an Apple bug where client_no_context_takeover is not properly implemented in newest Safari for iOS 15.

    Because of this, if you use compression and expect iOS 15 connections, you will have to enable uWS::DEDICATED_DECOMPRESSOR as well.

    See EchoServer.cpp example. uWS::DEDICATED_DECOMPRESSOR is available in v20.3.0 and forward. This adds about 44kb of memory usage per connection.

    an-apple-a-day 
    opened by ghost 34
  • Websockets Authorization

    Websockets Authorization

    Is there any best practice for implementing websockets authorization with uWS? In previous versions of the library it was possible to check a bearer token in the req.headers of the initial HTTP request before upgrading to websockets, then respond with status 401 oer whatever. Is this still possible somehow? currently I am doing the authorization in the ws callback like this:

    app
      .ws("/*", {
        /* Options */
        compression: CompressOptions.SHARED_COMPRESSOR,
        maxPayloadLength: 16 * 1024 * 1024,
        idleTimeout: 10,
        open: (ws, req) => {
          console.log("A WebSocket connected via URL: " + req.getUrl() + "!");
    
          console.log(ws, req.getHeader("authorization"));
    
          const authorization = req.getHeader("authorization");
    
          if (authorization) {
            const token = authorization.split(" ")[1];
            if (token) {
              ws.userId = getUserIdFromToken;
              if(ws.userId) {
                 return;
            }
          }
          // 404 is not a valid websocket error code
          ws.end(404, "Unauthorized");
        },
    

    Problem is that there are not suitable standard websocket error codes that express missing authorization or similar. Also it is not as clean as just doing the authorization before even starting the ws connection.

    high priority v18 API-breaking 
    opened by manast 29
  • GetQuery with optional parameters

    GetQuery with optional parameters

    Right now the getQuery function will ignore any parameter, woudln't it be nice to have the option to get the exact Query you are looking for? Making it optional so it doesn't affect performance at all if no params is sent

    opened by FerLuisxd 27
  • Reconsider pub/sub interfaces for v19

    Reconsider pub/sub interfaces for v19

    Hello

    socket.id = 1234;
    socket.subscribe("TOPIC1");
    socket.subscribe("TOPIC2");
    
    //Any way to do this?
    socket.getAllSubscribedTopics();  //returns ["TOPIC1", "TOPIC2"]
    

    How can i get the subscribed topics for a given socket. At the moment i keep a state myself in memory with the socket id and the subscribed topics, but i think the underlying library already keeps this state but i don't see a way to access that state.

    Thanks!

    API-breaking v19 
    opened by zappys 24
  • Missing way to read HttpRequest body/data for POST/PUT...

    Missing way to read HttpRequest body/data for POST/PUT...

    Apologies if I missed it, but I can't find a way to read the request body (the data after the headers) in HttpRequest.

    This would be needed in handling POST/PUT/... requests.

    Thanks in advance

    opened by christoth 22
  • Support of Cmake.

    Support of Cmake.

    Adding support of CMake, adds possibility to easily integrate uWebSockets to other C++ projects.

    For my project I wrote small CMakeLists.txt for uWebSockets and it works very well. So If maintainer of project agrees to add Cmake support I could prepare PR.

    opened by patriotyk 21
  • Streaming to pipelining client

    Streaming to pipelining client

    Hi. Thanks for library.

    I got issue in my library issues, which describes this:

    • When testing with stream file, under high-load headers duplicated (up to Infinity)
    • When under high-load, even not stream file, headers duplicated (1-5x times)
    • When testing with wrk this issue happens too
    • If as client using Safari, issue happening less than Chrome

    More info here and here

    bug v0.17 
    opened by dalisoft 18
  • Http3Transport draft implementation

    Http3Transport draft implementation

    uWS is going to implement the QUIC-based QuicTransport protocol as a complement to WebSocket.

    The idea is that since QuicTransport has the concept of URL, it can fit nicely into the app/routes concept that is so central to uWS:

    app.qt("/route", { // whatever behavior here })

    This can be applicable to web messaging that is not in need of reliable & ordered messaging, such as IO-games.

    uSockets v20 
    opened by ghost 17
  • Memory allocation error - incorrect checksum for freed object

    Memory allocation error - incorrect checksum for freed object

    Description

    Memory allocation errors occur when launching 100 servers that do not appear when launching 10 servers in the same configuration.

    • OS: Mac OS 10.14
    • Node: Homebrew v10.15.2

    Code to reproduce

    https://github.com/bunchtogether/braid-server/blob/master/tests/peers-ring.test.js

    (Apologies, I have been unable to reproduce in a simpler example.)

    Output

    node(65675,0x1091595c0) malloc: Incorrect checksum for freed object 0x104819200: probably modified after being freed.
    Corrupt value: 0x1baffed00baffedf
    node(65675,0x1091595c0) malloc: *** set a breakpoint in malloc_error_break to debug
    

    Extended Description

    The Braid application syncs key-value pairs between a small network of peers and a larger network of read-only subscribers. All communication between the peer and subscriber processes occurs over WebSockets.

    In this test 100 uWebSocket servers are created and linked in a ring using ws, i.e. peer A opens a connection to peer B, peer B opens a connection to peer C, peer C opens a connection to peer A.

    When the test is reduced to 10 uWebSocket servers the error does not occur.

    Thanks

    Thanks for the great work and let me know if there is any additional information I can provide.

    bug not reproducible 
    opened by wehriam 17
  • Fails to handle HTTP 1.0 requests

    Fails to handle HTTP 1.0 requests

    (For context, I ran into this problem when trying to have nginx proxy to a uWebSockets C++ program I wrote. The following distills it into an easier case.)

    If you connect to a server with a .get() method invoked to provide a get handler and send a request like this:

    echo -e "GET / HTTP/1.0\r\n\r\n" | nc localhost 3000 or echo -e "GET / HTTP/1.0\r\nhost: localhost\r\nConnection: close\r\n\r\n" | nc localhost 3000

    It times out and the uWS::App().get() handler never gets invoked.

    echo -e "GET / HTTP/1.1\r\nhost: localhost\r\nConnection: close\r\n\r\n" | nc localhost 3000 does, however, work.

    Here's a trivial server program that demonstrates the failure to handle HTTP/1.0 requests properly: include
    #include <App.h>

    int main(int argc, char** argv) {

    uWS::App().get("/*",[](auto *res, auto *req) { std::cout << "Got a request.\n"; res->end("Foo");}).listen(3000, [](auto *listen_socket) {}).run();                                                                                                         
    

    }

    opened by clansdown 0
  • Crash when client that never subscribed to anything disconnects

    Crash when client that never subscribed to anything disconnects

    In v.20.34.0

    https://github.com/uNetworking/uWebSockets/blob/988fdc7285014911dc34eec512d096fd819682db/src/WebSocket.h#L200

    Server crashes here when a WebSocket client that never subscribed to anything disconnects. webSocketData->subscriber is null in this case.

    bug has fix 
    opened by r52 0
  • CAPI uws_res_upgrade segfault

    CAPI uws_res_upgrade segfault

    I'm trying to integrate capi web sockets. It looks like uws_res_upgrade leads to a segfault with ssl. The segfault is reproduced in provided example UpgradeSync.c Compiler : gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

    opened by gigagrig 0
  • Generic helper for list based headers

    Generic helper for list based headers

    Should have built-in ways for iterating all values in a list header, including repeated headers:

    for (auto value : req->getHeaderList("some-header-with-list")) {

    }

    where delim is comma by default but can also be semi-comma for cookie header.

    Http 
    opened by uNetworkingAB 0
Releases(v20.35.0)
  • v20.35.0(Jan 3, 2023)

  • v20.34.0(Dec 28, 2022)

    Easy shutdown with App.close()

    Calling this new function will:

    • Close and invalidate all open listen sockets.
    • Force close all open connections (both HTTP and WebSockets), calling their respective callbacks as needed (.onAborted, .close, .subscription).

    This call can be used to gracefully close and release an App that needs maintenance.

    Source code(tar.gz)
    Source code(zip)
  • v20.33.0(Dec 27, 2022)

    Rebalancing with maxLifetime

    A reworked timeout system now allows two lightweight timeout settings for WebSockets; idleTimeout (up to 16 minutes) and maxLifetime (up to 4 hours):

    • idleTimeout is how long (in seconds) a WebSocket may be idle (have no traffic) before it is considered closed.
    • maxLifetime is how long (in minutes) a WebSocket may be connected, before being gracefully closed by the server.

    Specifying a value of 0 disables respective feature (the default for maxLifetime).

    Why use maxLifetime?

    The idea here is to enforce a partial rebalancing, constantly forcing a few connections to reconnect via whatever load balancer in use. This is a strategy used by Netflix where they found success in having maxLifetime = 30 minutes.

    Good values for the settings should be somewhere around 30-120 seconds idleTimeout and 30-120 minutes maxLifetime.

    Source code(tar.gz)
    Source code(zip)
  • v20.32.0(Dec 24, 2022)

    Subscription events

    A new kind of event has been added. Whenever a WebSocket::subscribe or WebSocket::unsubscribe call is made, or when implicit unsubscription happens (such as when a WebSocket has subscriptions and gets closed in any way), a subscription event will fire with:

    • the WebSocket involved
    • the topic name
    • the new number of subscribers to this topic
    • the former number of subscribers to this topic

    These events can be used to easily manage external subscriptions such as when using Redis to orchestrate multiple instances of uWS. Whenever a subscription event with new subscription count == 1; you can create the corresponding Redis subscription. Whenever a subscription event with new subscription count == 0; you can free the corresponding Redis subscription.

    Source code(tar.gz)
    Source code(zip)
  • v20.31.0(Nov 26, 2022)

  • v20.30.0(Nov 4, 2022)

  • v20.29.0(Nov 2, 2022)

    Hooking up Windows testing

    • GitHub Actions now builds and runs the unit tests and smoke test on Windows on every push.
    • The server was entirely broken on Windows, since the changes in v20.28.0 which is now fixed thanks to @rehans
    Source code(tar.gz)
    Source code(zip)
  • v20.28.0(Nov 1, 2022)

    More RFC 9112 (HTTP/1.1) compliance fixups

    • Field names are now restricted to alphanumeric + hyphen
    • Chunked encoding parsing now properly rejects too large chunks
    • Chunked encoding now rejects non-hex chunk size and handles A-F, a-f, 0-9 properly
    • The Host field has to be present, but is allowed to have empty value
    • Field values are trimmed both front and back, by SP and HTAB only
    • Request method is now case sensitive and getCaseSensitiveMethod() has been added
    • getMethod() will continue to return lower cased for backwards compatibility until v21.

    Performance regression testing

    • Performance comparison against the v20.0.0 release shows there is no performance drift. We haven't lost any measurable performance by improving spec. compliance.

    Smoke testing on CI

    • There is a new smoke test that makes a bunch of different fetch() requests in keep-alive using Deno, checking CRC32 hashes for correctness both for chunked encoding and for fixed length bodies. This test runs on CI automatically on every push along the unit tests. It will be extended with more request types in the near future.
    Source code(tar.gz)
    Source code(zip)
  • v20.27.0(Oct 29, 2022)

    Initial C-API

    Contributed by Ciro Spaciari (@cirospaciari) - there is now a quite complete C API that can be used from Zig, Rust and the like. Some form of this C API is already in use by Bun.

    Source code(tar.gz)
    Source code(zip)
  • v20.26.0(Oct 24, 2022)

    RFC 9112 (HTTP/1.1) compliance fixup

    HTTP/1.1 has been around since late stone age and there is now a new RFC9112 that updates it further, released this very summer. This is a good time to go over said spec. and make uWS as compliant as practically possible. This is going to be a gradual shift over time, making uWS more strict in this area, but here are some of the fixes in this release:

    • HTTP/1.0 requests are no longer accepted (so long Apache Bench!).
    • Content-Length and Transfer-Encoding are now more strictly and correctly parsed and used.
    • Requests without "host" header are dropped.
    • Requests with both Content-Length and Transfer-Encoding are dropped.
    • Requests with ridiculously large Content-Length are dropped.
    • Header values can no longer contain invisible control bytes (ASCII below 32), except for HTAB.
    • We are more strict in dropping requests with space between header key and colon.

    Some of these fixes are due to a report by FFRI Security, Inc. If you consider spec. compliance a security factor; then update to latest uWS.

    Source code(tar.gz)
    Source code(zip)
  • v20.25.0(Oct 18, 2022)

    Yet more Transfer-Encoding: chunked fixes

    • Keep-alive for chunked bodies was broken due to expecting an empty trailer which simply isn't there.
    Source code(tar.gz)
    Source code(zip)
  • v20.24.0(Oct 17, 2022)

    Date, Transfer-Encoding fixes

    • The HTTP server now appends a valid "Date" header to responses.
    • Fixes broken keep-alive for HEAD, OPTIONS, TRACE, CONNECT and DELETE methods introduced in v20.23.0 while adding chunked encoding support.
    Source code(tar.gz)
    Source code(zip)
  • v20.23.0(Oct 8, 2022)

    HTTP chunked transfer-encoding 🔪 🍰

    • You can now send and receive data that is chunked according to Transfer-Encoding: chunked.
    • Nothing changes from a user perspective; business as usual.
    Source code(tar.gz)
    Source code(zip)
  • v20.22.0(Oct 6, 2022)

    Dynamically removable HTTP routes and SNI domains

    Together with the SNI improvements from v20.18.0 you can now add/remove HTTP routes dynamically, both for the root ("catch all") domain, and for any specific SNI domain.

    If you added a route with

    app.get("/hello", [](auto *res, auto *req) {
    
    });
    

    You now remove it with app.get("/hello", nullptr);

    The same applies to routes added under a SNI name - browsing to the domain with app.domain("server_name") you can then remove the route added.

    Note that you cannot remove WebSocket routes just yet (but doing so could make sense semantically).

    Source code(tar.gz)
    Source code(zip)
  • v20.20.0(Sep 28, 2022)

  • v20.19.0(Sep 26, 2022)

    Unix sockets

    Thanks to @Young-Flash it's now possible to serve HTTP and WebSockets over Unix sockets - which interestingly works on all three platforms Windows, Linux, macOS 🤔

    Source code(tar.gz)
    Source code(zip)
  • v20.18.0(Sep 26, 2022)

    Improved SNI support

    This is a backwards compatible change that detaches the URL router from the App, and moves it underneath the SNI support (if any). The new hierarchy is: App -> (SNI) -> URL router.

    SNI

    One App can have the root level SSL certificate and its URL routes, and/or many per-domain SSL certificates and their own isolated URL routes.

    You "browse" between different SNI domains by calling the new function app.domain(server name) before calling app.get or app.post or any such route registration call. This can be chained together in builder pattern. Last "browsed to" SNI is under where you register the URL route handler.

    See example ServerName for usage.

    Source code(tar.gz)
    Source code(zip)
  • v20.17.0(Sep 25, 2022)

    Improved HTTP timeout logic

    When a client uploads (HTTP POST) a large file there has been a less-than-ideal timeout logic in uWS, where practically 0.1 byte/sec was enough to keep the connection open. This version bumps the required upload throughput to 16kB/sec as the lowest allowed. Any client uploading slower, will be dropped. You can configure the constant HTTP_RECEIVE_THROUGHPUT_BYTES as you wish.

    Source code(tar.gz)
    Source code(zip)
  • v20.16.0(Sep 4, 2022)

    HTTP/3 Cinema 🍿 📽️

    While still highly experimental, the HTTP/3 support is now functional enough to stream a large video file correctly and without corruption. The video is shown being played by Firefox here, but has since also been tested to work with Chrome, curl and quiche-client.

    This is a very visual milestone - it shows not only HTTP/3 working, but both HTTP/1 and HTTP/3 working together on the same thread. As you can see in the picture, an HTTP/1 server is used to instruct (at least Firefox?) the browser to go use the HTTP/3 one instead.

    h3cinema

    Source code(tar.gz)
    Source code(zip)
  • v20.15.0(Aug 29, 2022)

    Experimental HTTP/3 via uWS::H3App

    • Adds experimental uWS::H3App and example. With this type of app you can handle HTTP/3 requests with the same identical interface as for uWS::SSLApp, uWS::App. No code changes needed.
    • This support is hidden under WITH_QUIC flag and entirely unsupported / for testing feedback / smoke testing only.
    • Benchmarks are here.
    • Working example is here.

    How to test it

    • This is experimental work entirely hidden under the WITH_QUIC make flag and disabled by default.
    • Compile with WITH_BORINGSSL=1 WITH_QUIC=1 make and run the Http3Server binary. You can test it using quiche-client over IPv6 (you will need an IPv6 localhost address or else it will fail to listen). See Http3Server.cpp for an example quiche-client invocation.
    • You first need to compile both lsquic and boringssl in respective git submodule paths. See their documentation for how to do this (it's pretty easy).
    Source code(tar.gz)
    Source code(zip)
  • v20.14.0(May 2, 2022)

    Streaming large HTTP response fix

    • Fixes a potential heap-use-after-free when finishing (tryEnd, end) an Http response within onWritable callback (captured variables are destroyed).
    • Affects only users who stream large Http responses with the use of onWritable callback. If your application never sets an onWritable callback, then you're not affected.
    • See uWebSockets.js/examples/VideoStreamer.js for an example of affected use.

    Thanks to @o5k @zdm

    Source code(tar.gz)
    Source code(zip)
  • v20.13.0(Apr 20, 2022)

    This release fixes a minor issue where the HTTP parser did not allow header values with bytes above 7-bit ASCII. Now it is possible to receive any byte sequence except for terminating CRLF. A unit test for this was added.

    Source code(tar.gz)
    Source code(zip)
  • v20.12.0(Mar 17, 2022)

    Safari 15.4 finally fixed?

    It is believed that Apple finally fixed their permessage-deflate ("WebSocket compression") in Safari 15.4. This release will disable permessage-deflate for broken versions of Safari (15.0 - 15.3), but not for 15.4 and forwards. If you experience issues with Safari 15.4 and compression, report it and we can mark 15.4 as broken as well. Apple is not a transparent company and we cannot know what black magic they are up to and their releases do not explain anything.

    Think different, think Apple. And now punch yourself in the face. Mmm, nosebleed.

    Source code(tar.gz)
    Source code(zip)
  • v20.11.0(Jan 27, 2022)

    • All versions of Safari 15 for iOS and macOS are entirely broken when it comes to WebSocket. This release adds exceptions to the standard, applied only to Safari user agents in order to play along with Apple's thorough and unmatched incompetence.
    Source code(tar.gz)
    Source code(zip)
  • v20.10.0(Jan 25, 2022)

  • v20.9.0(Jan 4, 2022)

    • Adds HttpResponse::pause, HttpResponse::resume for throttling of data I/O.
    • Adds new fast path for zero masked WebSocket messages and optimizes large message unmasking.
    • Fixes HttpRouter ordering issues in certain undiscovered edge cases & adds tests.
    • Adds endWithoutBody for responding without a body or content-length.
    • Clear subscriptions before calling close handler, not after.
    Source code(tar.gz)
    Source code(zip)
  • v20.8.0(Oct 31, 2021)

  • v20.7.0(Oct 30, 2021)

    More decompressors

    • Fixes DEDICATED_DECOMPRESSOR introduced in v20.3.0
    • Adds a range of DEDICATED_DECOMPRESSOR_32KB .. DEDICATED_DECOMPRESSOR_512B
    Source code(tar.gz)
    Source code(zip)
  • v20.6.0(Oct 18, 2021)

  • v20.5.0(Sep 30, 2021)

    Reordering & flags fix

    • In v19.8.0 while optimizing large message sending, a reordering bug was introduced that may reorder outgoing messages.
    • uSockets 0.8.1 fixes a bug passing invalid flags down to send syscall.
    Source code(tar.gz)
    Source code(zip)
Owner
uNetworking AB
uNetworking AB
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 48 Oct 13, 2022
Ole Christian Eidheim 741 Dec 27, 2022
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.9k Dec 20, 2022
server secure chat

nem server api Register Login GetList Handshake Message Feed StatusOnline HandshakeKey HandshakeNotice FileAdd StorageFile GetFile Register { "type":

Dmitrii 6 Apr 3, 2022
A protocol for secure client/server connections over UDP

netcode netcode is a simple connection based client/server protocol built on top of UDP. It has the following features: Encrypted and signed packets S

The Network Protocol Company 2.3k Dec 26, 2022
A protocol for secure client/server connections over UDP

netcode netcode is a simple connection based client/server protocol built on top of UDP. It has the following features: Encrypted and signed packets S

The Network Protocol Company 2.3k Jan 3, 2023
:hocho: Strictly RFC 3986 compliant URI parsing and handling library written in C89; moved from SourceForge to GitHub

uriparser uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C89 ("ANSI C"). uriparser is cross-platform, fast, su

uriparser 260 Dec 28, 2022
🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.

Oat++ News Hey, meet the new oatpp version 1.2.5! See the changelog for details. Check out the new oatpp ORM - read more here. Oat++ is a modern Web F

Oat++ 6k Jan 4, 2023
C Hypertext Library - A library for writing web applications in C

CHL C Hypertext Library - A library for writing web applications in C #include <chl/chl.h> int main() { chl_set_default_headers(); chl_print_header

null 271 Nov 14, 2022
A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

Mark Hofmeister 2 Mar 9, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 9k Jan 1, 2023
When you need a web server in a hurry.

darkhttpd https://unix4lyfe.org/darkhttpd/ When you need a web server in a hurry. Features: Simple to set up: Single binary, no other files, no instal

Emil Mikulic 866 Jan 6, 2023
web server that will print hello world on the screen only for linux users

a simple http server side lib only for linux users Note: This lib is currently under development you can check the source code and even use it but dn'

notaweeb 11 Mar 14, 2021
cServe : mean and lean web server written in c

cServe =========== cServe is a web server written in c for POXIS compliant operating systems cServe is planned to be [ ] Supporting HTTP/1.x and HTTP/

Ayush Kumar 1 Dec 21, 2021
reverse proxy with web server and preview page

Reverse Proxy Dependencies Go Make Suport Termux (android/afsd kernel) linux (kernel) Install: Termux: 1 step: Install Go-lang, Git and Make pkg insta

AlbâniaSecurity-RT 9 Dec 8, 2022
Update ESP32 firmware over WiFi from a web server

esp32-firmware-update Update ESP32 firmware over WiFi from Github This includes a python script which generates the update json file based on the firm

Felix Biego 12 Dec 10, 2022
A purely bash web server, no socat, netcat, etc...

Bash-web-server A purely bash web server, no socat, netcat, etc... Requirement bash 5.1 loadable accept builtin (http://git.savannah.gnu.org/cgit/bash

null 624 Dec 29, 2022
WAFer is a C language-based software platform for scalable server-side and networking applications. Think node.js for C programmers.

WAFer WAFer is a C language-based ultra-light scalable server-side web applications framework. Think node.js for C programmers. Because it's written i

Riolet Corporation 693 Dec 6, 2022
Lightway Core is a modern VPN protocol by ExpressVPN, to deliver a VPN experience that’s faster, more secure, and more reliable.

Lightway Core NOTE: This is a preview snapshot of the Lightway repository used for both our client and server. We will be publishing a live, actively

ExpressVPN 22 Feb 17, 2022