warmcat/libwebsockets logo

warmcat/libwebsockets

Free

canonical libwebsockets.org networking library

FreeFree tier
Type
Open Source

About warmcat/libwebsockets

Libwebsockets is a simple-to-use, MIT-licensed, pure C library providing client and server support for HTTP/1, HTTP/2, WebSockets, MQTT, and other protocols. It is designed to be lightweight, configurable, scalable, and flexible, suitable for tasks from embedded RTOS to mass cloud serving. The library supports a wide range of TLS backends including OpenSSL, MbedTLS, GnuTLS, SChannel, BearSSL, and others, and includes built-in support for QUIC, HTTP/3, and WebTransport. It integrates with multiple event loops (libuv, libevent, libev, sdevent, glib, uloop) and provides over 100 independent minimal examples to accelerate development. Ancillary implementations for JSON, CBOR, JOSE, and COSE are also included.

Key Features

Client and server for HTTP/1, HTTP/2, WebSockets, MQTT
Support for QUIC, HTTP/3, and WebTransport
Multiple TLS backends: OpenSSL, MbedTLS, GnuTLS, SChannel, BearSSL, others
Event loop sharing: libuv, libevent, libev, sdevent, glib, uloop
Over 100 CC0-licensed minimal examples
Built-in ancillary implementations for JSON, CBOR, JOSE, COSE
Lightweight and configurable via cmake, suitable for embedded RTOS and cloud serving

Pros & Cons

Pros
  • MIT license allows flexible use in commercial and open-source projects
  • Wide TLS library support ensures compatibility across platforms
  • Extensive event loop integration fits many application architectures
  • Large collection of ready-to-use examples accelerates development
  • Supports modern protocols like QUIC, HTTP/3, and WebTransport
Cons
  • Primarily C code may require careful memory management
  • Documentation can be dense for newcomers
  • Some advanced features (e.g., QUIC) require specific TLS backends and build configuration

Best For

Building WebSocket servers for real-time applicationsEmbedded IoT devices with MQTT or HTTP communicationReverse proxies and HTTP/2 serversSecure communication with TLS in constrained environmentsRapid prototyping with provided minimal examples

FAQ

What protocols does libwebsockets support?
It supports HTTP/1, HTTP/2, WebSockets, MQTT, and includes support for QUIC, HTTP/3, and WebTransport on certain TLS backends.
Which TLS libraries can I use with libwebsockets?
The library supports OpenSSL, MbedTLS, GnuTLS, SChannel, BearSSL, LibreSSL, AWS-LC, BoringSSL, wolfSSL, and openHiTLS.
Is libwebsockets suitable for embedded systems?
Yes, it is designed for lightweight use and can run on embedded RTOS platforms, with cmake-based cross-build support.
Is there documentation and examples?
The repository includes over 100 independent minimal examples that are CC0-licensed (public domain) for reuse.