Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"en-US,en;q\u003d0.5", "gen_ut":1638088988, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ { "schema":"libjg2-1", "oid":{ "oid": "44dd63a03dbea8dd22ed00824ae1450e9bffa4ae", "alias": [ "refs/heads/main"]},"tree": [ { "name": "READMEs","mode": "16384", "size":0}, { "name": "cmake","mode": "16384", "size":0}, { "name": "contrib","mode": "16384", "size":0}, { "name": "doc-assets","mode": "16384", "size":0}, { "name": "include","mode": "16384", "size":0}, { "name": "lib","mode": "16384", "size":0}, { "name": "lwsws","mode": "16384", "size":0}, { "name": "minimal-examples","mode": "16384", "size":0}, { "name": "minimal-examples-lowlevel","mode": "16384", "size":0}, { "name": "plugin-standalone","mode": "16384", "size":0}, { "name": "plugins","mode": "16384", "size":0}, { "name": "scripts","mode": "16384", "size":0}, { "name": "test-apps","mode": "16384", "size":0}, { "name": "win32port","mode": "16384", "size":0}, { "name": ".gitignore","mode": "33188", "size":790}, { "name": ".mailmap","mode": "33188", "size":103}, { "name": ".sai.json","mode": "33188", "size":22911}, { "name": "CMakeLists-implied-options.txt","mode": "33188", "size":11076}, { "name": "CMakeLists.txt","mode": "33188", "size":43607}, { "name": "Kconfig","mode": "33188", "size":857}, { "name": "LICENSE","mode": "33188", "size":14706}, { "name": "Makefile.projbuild","mode": "33188", "size":54}, { "name": "README.md","mode": "33188", "size":8349}, { "name": "bug_report.md","mode": "33188", "size":2120}, { "name": "changelog","mode": "33188", "size":33272}, { "name": "component.mk","mode": "33188", "size":1659}, { "name": "libwebsockets.dox","mode": "33188", "size":15085}],"s":{"c":1637613739,"u": 1616}} ,{"schema":"libjg2-1", "cid":"a90427da27feb44f4cdf8826ba6f8c69", "oid":{ "oid": "44dd63a03dbea8dd22ed00824ae1450e9bffa4ae", "alias": [ "refs/heads/main"]},"blobname": "README.md", "blob": "[![CI status](https://libwebsockets.org/sai/status/libwebsockets)](https://libwebsockets.org/git/libwebsockets) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3576/badge.svg)](https://scan.coverity.com/projects/3576) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2266/badge)](https://bestpractices.coreinfrastructure.org/projects/2266) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/144fb195a83046e484a75c8b4c6cfc99)](https://www.codacy.com/app/lws-team/libwebsockets?utm_source\u003dgithub.com\u0026amp;utm_medium\u003dreferral\u0026amp;utm_content\u003dwarmcat/libwebsockets\u0026amp;utm_campaign\u003dBadge_Grade) [![Total alerts](https://img.shields.io/lgtm/alerts/g/warmcat/libwebsockets.svg?logo\u003dlgtm\u0026logoWidth\u003d18)](https://lgtm.com/projects/g/warmcat/libwebsockets/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/warmcat/libwebsockets.svg?logo\u003dlgtm\u0026logoWidth\u003d18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:cpp) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/warmcat/libwebsockets.svg?logo\u003dlgtm\u0026logoWidth\u003d18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:javascript)\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](https://libwebsockets.org/git/libwebsockets/tree/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](https://libwebsockets.org/git/libwebsockets/tree/READMEs) on a variety of topics.\n\n[We do a huge amount of CI testing per push](https://libwebsockets.org/sai/), 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](https://warmcat.com/2021/08/21/Sai-CI.html).\n\n![overview](./doc-assets/lws-overview.png)\n\nNews\n----\n\n## Perl binding for lws available\n\nThanks to Felipe Gasper, there's now a [perl binding for lws available at metacpan](https://metacpan.org/pod/Net::Libwebsockets),\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](https://libwebsockets.org/git/libwebsockets/tree/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 https://libwebsockets.org\n\nand consider joining the project mailing list at\n\n https://libwebsockets.org/mailman/listinfo/libwebsockets\n\nYou can get the latest version of the library from git:\n\n- https://libwebsockets.org/git\n\nDoxygen API docs for development: https://libwebsockets.org/lws-api-doc-main/html/index.html\n\n","s":{"c":1637613739,"u": 2250}} ],"g": 1162,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "7d0a"}