libwebsockets: one C library, every protocol, ten TLS stacks
canonical libwebsockets.org networking library
At a glance
- What is it?
- libwebsockets is a MIT-licensed pure C library providing client and server implementations of HTTP/1, HTTP/2, HTTP/3, WebSockets, WebTransport and MQTT, from embedded RTOS targets through cloud serving, with QUIC and H3 new in version 5, WebRTC mixing, HLS serving, and a TLS compatibility matrix spanning ten libraries from OpenSSL to SChannel. Its 100-plus minimal examples are CC0-licensed for cut-and-paste, and the maintainers state pre-5.0 releases are effectively deprecated for security reasons.
- Who is it for?
- Use libwebsockets when one C dependency must cover HTTP generations, WebSockets, MQTT and now WebTransport across embedded and server targets, with event loop integration into an existing application and a choice of TLS backends that matches each platform's native stack. Use a single-protocol library when the need is WebSocket only and the smaller surface is preferred, or libcurl when the job is strictly client-side transfers.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A protocol portfolio in pure C
libwebsockets describes itself as a simple-to-use, MIT-license, pure C library providing client and server for http/1, http/2, http/3, websockets, webtransport and MQTT, in a security-minded, lightweight, configurable, scalable and flexible way, and the list is the product, one dependency covering the modern web protocol family in both directions. The scope positions it across the entire deployment range, easy to build and cross-build via CMake, suitable from embedded RTOS through mass cloud serving, the span few libraries attempt because it constrains both footprint and feature depth simultaneously. Around the protocols sit lightweight ancillary implementations for JSON, CBOR, JOSE and COSE, the data formats those protocols carry, and the project is described as very gregarious about event loop sharing, integrating libuv, libevent, libev, sdevent, glib and uloop plus custom event libraries, so an application already running one of those loops adopts it without a second poller. GitHub's license detection reports NOASSERTION, but the README's own statement is MIT.
Version 5, and a deprecation with a reason
The README's most emphatic paragraph is an upgrade notice, V5.0 now available, please upgrade to this or preferably v5.0-stable or main, because there are many security fixes only available on v5.0-stable and main, and pre-5.0 releases are effectively deprecated. The unusual part is the transparency around the audit producing those fixes, a continuous incremental security audit in place finding and fixing new problems, which the author preempts misreading, it is not a sign the code is weak, it is a sign frontier models are being used to make it extremely strong. Whatever one makes of the phrasing, the operational instruction is unambiguous, the maintained lines are v5.0-stable and main, and anything older should be treated as carrying known, unfixed issues. There are no GitHub releases in the conventional sense, versioning living in the changelog and the branch structure instead, and the repository's last push came on 2026-09-27.
QUIC, H3 and WebTransport, with the OpenSSL catch
The headline features of version 5 extend the protocol portfolio into the QUIC family, QUIC plus HTTP/3 plus WebTransport, alongside WebRTC mixing the README describes as like your own zoom, and HLS serving for streaming. The implementation supports multiple TLS engines for the QUIC transport, aws-lc, wolfSSL, BoringSSL, LibreSSL, GnuTLS and SChannel, and the README is explicit about the two exceptions, upstream OpenSSL does not provide the necessary QUIC TLS API, SSL_set_quic_method, so OpenSSL is http/1 and http/2 only, and mbedTLS can do QUIC only via a patch, with BoringSSL or GnuTLS recommended where QUIC and HTTP/3 matter. A platform table summarizes the defaults, SChannel on Windows in 5.0 plus, meaning Windows builds need no OpenSSL at all, GnuTLS as the default on Unix when QUIC is enabled in the default build, which the README notes is the case, and mbedTLS on FreeRTOS, a table an embedded integrator reads before choosing flags.
The TLS capability matrix
Below the version table sits a ten-library capability matrix, and reading it is the practical due diligence for any adoption. GnuTLS, LibreSSL, AWS-LC, BoringSSL, wolfSSL, mbedTLS and SChannel each support server and client TLS, QUIC transport, WSS and HTTPS, MQTT over TLS, ALPN, DTLS, session caching and general cryptography, with GnuTLS the only full-coverage row including the QUIC transport. OpenSSL covers everything except QUIC. BearSSL and openHiTLS lack QUIC, BearSSL lacks DTLS, and openHiTLS's DTLS is yes except SRTP, the WebRTC media path. New TLS backends added in 5.0 include SChannel, GnuTLS, openHiTLS and BearSSL, broadening the library past the OpenSSL-and-mbedTLS pairing it was known for, each mapping to a platform constraint, Windows native TLS, size-constrained embedded targets, or the FIPS-shaped clouds. The matrix is the kind of documentation that replaces an afternoon of build-flag archaeology with a table lookup, and the two footnoted exceptions are stated rather than left to be discovered in a linker error.
100-plus minimal examples, CC0 for cut-and-paste
The learning material is the library's quietest advantage, more than one hundred independent minimal examples covering various scenarios, licensed CC0, effectively public domain, explicitly for cut-and-paste, so a working starting point for a scenario can be lifted into a project without license contamination. They live in two directories, minimal-examples for the common cases and minimal-examples-lowlevel for the deeper ones. Alongside them sit a large collection of topic READMEs, Doxygen API documentation hosted with the project, and test-apps for exercising the surface, plus a fuzz directory for the input robustness side. The README also states a huge amount of CI testing runs per push, with the SAI page documenting it, and external validation badges for Coverity static analysis and the CII best practices program. For a C library where an example compile failure wastes an afternoon, the CC0 examples are the feature that most directly shortens time-to-first-packet.
Built for integration, not just standalone
The repository's layout tells the integration story, plugins and standalone plugin directories for extension, lwsws for the serving configuration, contrib for community pieces, win32port for the Windows path, and a Kconfig plus component.mk that mark the Zephyr and embedded build integrations, the files an RTOS build system looks for. DHT support ships built-in behind a CMake flag, -DLWS_WITH_DHT=1, the distributed hash table for peer-discovery scenarios. The event loop sharing covered earlier is the deeper integration axis, a library that adopts the application's libuv or glib loop rather than demanding its own is embeddable in daemons that already have opinions about their reactor. Combined with the TLS matrix, the design reads as a toolkit assembled for the awkward middle of networking, embedded devices that must speak modern web protocols inside systems that cannot rebuild around a new runtime, which is precisely the niche pure-C networking libraries continue to own.
Where it sits among the neighbors
The comparisons people search for name uWebSockets, WebSocketpp, Boost.Beast and libcurl, and each marks a boundary rather than a rivalry. uWebSockets and WebSocketpp are WebSocket-focused libraries in the C++ ecosystem, Boost.Beast binds WebSocket and HTTP to Asio in C++, and libcurl is a client-side transfer library rather than a server, so the choice follows language and role, pure C or C++, serving or fetching, one protocol or the family. libwebsockets' distinct combination is breadth in one C dependency, both client and server across the HTTP generations plus MQTT and WebTransport, with the TLS backend chosen per platform from ten options, and an examples corpus that makes the breadth approachable. The honest cost is surface, an API covering that much ground asks more of the reader than a single-protocol library, and the pre-5.0 deprecation adds a version discipline requirement, but for a system that must serve HTTP/3 on one platform and WebSocket on a microcontroller on another, the alternatives are multiple libraries or this one.
Editorial conclusion
Use libwebsockets when one C dependency must cover HTTP generations, WebSockets, MQTT and now WebTransport across embedded and server targets, with event loop integration into an existing application and a choice of TLS backends that matches each platform's native stack. Use a single-protocol library when the need is WebSocket only and the smaller surface is preferred, or libcurl when the job is strictly client-side transfers. Verify first that your TLS library choice supports the features you need against the documented matrix, QUIC and HTTP/3 rule out plain OpenSSL, build from v5.0-stable or main as the project states pre-5.0 is effectively deprecated, and start from the CC0 minimal examples before reading the API reference.
Frequently asked questions
How do you use libwebsockets?
Start from the 100-plus minimal examples, which are CC0-licensed for cut-and-paste and cover various scenarios in minimal-examples and minimal-examples-lowlevel. The Doxygen API documentation and the topic READMEs in the repository cover the full surface.
How do you install libwebsockets?
Build from source with CMake, which the project describes as easy to build and cross-build. Build from v5.0-stable or main rather than a pre-5.0 tag, since the maintainers state security fixes exist only on the v5.0 lines and older releases are effectively deprecated.
Does libwebsockets support HTTP/3 and QUIC?
Yes, QUIC, HTTP/3 and WebTransport are implemented and enabled in the default build, which uses GnuTLS on Unix for that reason. Upstream OpenSSL lacks the QUIC TLS API required, so QUIC users are pointed to BoringSSL or GnuTLS, and mbedTLS needs a patch.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/warmcat-libwebsockets)