Project homepage Mailing List  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1721657604, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"", "f":3, "items": [ {"schema":"libjg2-1", "cid":"09a1479f66971e31d21cbd1aad357fcd", "oid":{ "oid": "8674bf1585c0196f071eb6f0ae2184c9ca053301", "alias": [ "refs/heads/main"]},"blobname": "", "blob": "[![CI status](]( [![Coverity Scan Build Status](]( [![CII Best Practices](]( [![Codacy Badge](](\\u0026amp;utm_medium\u003dreferral\u0026amp;utm_content\u003dwarmcat/libwebsockets\u0026amp;utm_campaign\u003dBadge_Grade) [![Total alerts](\u003dlgtm\u0026logoWidth\u003d18)]( [![Language grade: C/C++](\u003dlgtm\u0026logoWidth\u003d18)]( [![Language grade: JavaScript](\u003dlgtm\u0026logoWidth\u003d18)](\n\n# Libwebsockets\n\nLibwebsockets is a simple-to-use, MIT-license, pure C library providing client and server\nfor **http/1**, **http/2**, **websockets**, **MQTT** and other protocols in a security-minded,\nlightweight, configurable, scalable and flexible way. It's easy to build and\ncross-build via cmake and is suitable for tasks from embedded RTOS through mass\ncloud serving.\n\nIt supports a lot of lightweight ancilliary implementations for things like JSON,\nCBOR, JOSE, COSE, and supports OpenSSL and MbedTLS v2 and v3 out of the box for everything.\nIt's very gregarious when it comes to event loop sharing, supporting libuv, libevent, libev,\nsdevent, glib and uloop, as well as custom event libs.\n\n[100+ independent minimal examples]( for various scenarios, CC0-licensed\n(public domain) for cut-and-paste, allow you to get started quickly.\n\n[There are a lot of READMEs]( on a variety of topics.\n\n[We do a huge amount of CI testing per push](, currently 582 builds on 30 platforms.\n[You can see the lws CI rack and read about how lws-based Sai is used to coordinate all the testing](\n\n![overview](./doc-assets/lws-overview.png)\n\nNews\n----\n\n## HTML + CSS + JPEG + PNG display stack in lws\n\nWant to drive your EPD or TFT / OLED display using HTML + CSS? Only got an ESP32?\n\nWant remote JPEGs, PNGs, HTML, RGBA composition, gamma, error diffusion if needed?\n\nRealtime render into a line buffer because you don't have enough heap for a framebuffer?\n\n[Take a look here...](\n\n## Perl binding for lws available\n\nThanks to Felipe Gasper, there's now a [perl binding for lws available at metacpan](,\nthis uses the recent generic event loop support in lws to have lws as a guest on an existing perl event loop.\n\n## Lws examples switching to Secure Streams\n\n![Secure Streams direct](./doc-assets/ss-api1.png)\n\n**Secure Streams** support in lws was introduced a couple of years ago, it's a\nhigher-level interface to lws `wsi`-level apis that simplifies connectivity by\nsegregating connection policy like protocol and endpoint information into a\nseparate [JSON policy file](./minimal-examples/client/hello_world/example-policy.json), and just having the [code deal with payloads](./minimal-examples/clients/hello_world/hello_world-ss.c); as many\ndetails of the wire protocol as possible are hidden or moved to the policy, so\nuser code is almost identical even if the wire protocol changes.\n\nThe user code just asks to create a SS by \u0022streamtype name\u0022, it is created\naccording to the details (protocol, endpoint, etc) under the same name in the\npolicy.\n\nKey policy entries like endpoint can contain `${metadata-name}` string\nsubstitutions to handle runtime adaptations via metadata. h1, h2, ws and mqtt\nare supported.\n\nAs a layer on top of the `wsi` apis, SS provides a higher-level way to access\nthe existing wsi-level capabilities, both kinds of API will remain supported.\nSecure Streams are longer-lived than a single wsi, so an SS can coordinate\nretries by itself. SS-based user code is typically significantly smaller and\nmore maintainable than wsi layer.\n\nIn main branch I have moved the older examples into `./minimal-examples-lowlevel`\nand am starting to port more cases from there into SS-based examples.\n\n### Comparison between wsi and SS level lws usage\n\n|Feature|\u0022low-level\u0022 wsi way|Secure Streams way|\n|---|---|---|\n|Create context|code|same|\n|Loop support, sul scheduler|default, event libs|same|\n|Supports comms mode|Client, Server, Raw|same|\n|Supports protocols|h1, h2, ws, mqtt (client)|same|\n|TLS support|mbedtls (including v3), openssl (including v3), wolfssl, boringssl, libressl|same|\n|Serializable, proxiable, muxable, transportable|No|Yes|\n|Auto-allocated per-connection user object|pss specified in lws_protocols|Specified in ss info struct|\n|Connection User API|Protocol-specific lws_protocols cbs (\u003e 100)|SS API (rx, tx, state callbacks only)|\n|Sending adaptation|lws_callback_on_writeable() + WRITEABLE|lws_ss_request_write() + tx() cb|\n|Sending buffer|User-chosen + malloc'd partial handling|SS-provided, no partials|\n|Create vhosts|code|**JSON policy**|\n|TLS validation|cert bundle or code|**JSON policy**, or cert bundle|\n|Connection retry / backoff|code|**JSON policy**, Auto|\n|Nailing up|code|**JSON policy**, Auto|\n|Endpoint and protocol details|spread around the code|**JSON policy**|\n|Protocol selection, pipeline / stream sharing|code|**JSON policy**|\n|ws subprotocol selection|code|**JSON policy**|\n|ws binary / text|code|**JSON policy**|\n|Protocol-specific metadata|Protocol-specific apis in code (eg, lws_hdr)|**JSON policy**, generic metadata apis in code|\n|Connection validity rules|struct|**JSON policy**, Auto|\n|Stream as Long Poll|code|**JSON policy**|\n|Auth|code|**JSON policy** + automatic rotation if provider supported, else code|\n\n### Serialized Secure Streams\n\n![Secure Streams direct](./doc-assets/ss-api2.png)\n\nSecure Streams APIs are also **serializable**, the exact same client code can\nfulfil the connection directly in the same process as you would expect, or\nforward the actions, metadata and payloads to an [SS Proxy](./minimal-examples/ssproxy/ssproxy-socket) that owns the policy\nover a Unix Domain or TCP socket connection to be fulfilled centrally. This\nallows, eg, h2 streams from different processes sharing a single connection.\n\n![Secure Streams direct](./doc-assets/ss-api3.png)\n\nThe serialized SS can also travel over generic transports like UART, an [example\nis provided implementing the Binance example on an RPi Pico](./minimal-examples/embedded/pico/pico-sspc-binance) with a UART transport\nto a [UART transport SS proxy](./minimal-examples/ssproxy/ssproxy-custom-transport-uart), where the pico itself has no network stack, tls, compression or\nwss stack, but can send and receive to and from the endpoint as if it did.\n\nThe optional `lws_trasport_mux` is used to interpose between the UART transport\nand the SSPC layer, allowing a single pipe to carry many separate SS connections.\n\nThe user SS code is identical however it is transported, muxed and fulfilled.\n\n\n## v4.3 is released\n\nSee the [changelog](\n\n\n## Lws work retrospective\n\nThe initial commit for lws will have been 11 years ago come Oct 28 2021, it's been a lot of work.\nThere are a total of 4.3K patches, touching 800KLOC cumulatively (this is not the size in the\nrepo, but over the years, how many source lines were changed by patches).\n\n![overview](./doc-assets/work.png)\n\nGratifyingly, it turns out over the years, ~15% of that was contributed by 404 contributors: that's not so bad.\nThanks a lot to everyone who has provided patches.\n\nToday at least tens of millions of devices and product features rely on lws to\nhandle their communications including several from FAANG; Google now include lws\nas part of Android sources.\n\n## Support\n\nThis is the libwebsockets C library for lightweight websocket clients and\nservers. For support, visit\n\n\n\nand consider joining the project mailing list at\n\n\n\nYou can get the latest version of the library from git:\n\n-\n\nDoxygen API docs for development:\n\n","s":{"c":1721576137,"u": 505}} ],"g": 8268,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "7d0a"}