[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6185":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":15,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":39,"discoverSource":40},6185,"mongoose","cesanta\u002Fmongoose","cesanta","Embedded web server, with TCP\u002FIP network stack, MQTT and Websocket","https:\u002F\u002Fmongoose.ws",null,"C",12860,2919,467,2,0,26,83,14,45,"Other",false,"master",[25,26,27,28,29,30,31,32,33,34,35],"embedded","http","iot","mqtt","tcp","tcpip","tls13","udp","web-server","webserver","websocket","2026-06-12 02:01:16","# Mongoose - Embedded Web Server \u002F Embedded Network Library\n\n[![License: GPLv2\u002FCommercial](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-GPLv2%20or%20Commercial-green.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002Fgpl-2.0.php)\n[![Build Status]( https:\u002F\u002Fgithub.com\u002Fcesanta\u002Fmongoose\u002Factions\u002Fworkflows\u002Fquicktest.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fcesanta\u002Fmongoose\u002Factions)\n[![Code Coverage](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fcesanta\u002Fmongoose\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fcesanta\u002Fmongoose)\n[![Fuzzing Status](https:\u002F\u002Foss-fuzz-build-logs.storage.googleapis.com\u002Fbadges\u002Fmongoose.svg)](https:\u002F\u002Fissues.oss-fuzz.com\u002Fissues?sort=-opened&can=1&q=proj:mongoose)\n\n\u003Cimg src=\"https:\u002F\u002Fmongoose.ws\u002Fimages\u002Flogo.svg\" width=\"48\" height=\"48\" align=\"left\" style=\"float:left;\" \u002F> Mongoose is a network library for C\u002FC++.  It provides event-driven non-blocking\nAPIs for TCP, UDP, HTTP, WebSocket, MQTT, and other protocols.  It is designed\nfor connecting devices and bringing them online. On the market since 2004, used\nby vast number of open source and commercial products - it even runs on the\nInternational Space Station!  Mongoose makes embedded network programming fast,\nrobust, and easy. Features include:\n\n- Cross-platform:\n  - works on Linux\u002FUNIX, MacOS, Windows, Android\n  - works on ST, NXP, ESP32, Nordic, TI, Microchip, Infineon, Renesas and other chips\n  - write code once - and it'll work everywhere\n  - ideal for the unification of the network infrastructure code across company\n- Built-in protocols: plain TCP\u002FUDP, SNTP, HTTP, MQTT, Websocket, and other\n- Asynchronous DNS resolver\n- Tiny static and run-time footprint\n- Source code is both ISO C and ISO C++ compliant\n- Easy to integrate: just copy [mongoose.c](https:\u002F\u002Fraw.githubusercontent.com\u002Fcesanta\u002Fmongoose\u002Fmaster\u002Fmongoose.c)\n  and [mongoose.h](https:\u002F\u002Fraw.githubusercontent.com\u002Fcesanta\u002Fmongoose\u002Fmaster\u002Fmongoose.h) files to your source tree\n- Built-in TCP\u002FIP stack with drivers for bare metal or RTOS systems\n   - Available drivers: STM32F, STM32H; NXP RT1xxx; TI TM4C; Microchip SAME54; Wiznet W5500\n   - A complete Web device dashboard on bare metal ST Nucleo boards is only 6 files\n   - For comparison, a CubeIDE generated HTTP example is 400+ files\n- Can run on top of an existing TCP\u002FIP stack with BSD API, e.g. lwIP, Zephyr, Azure, etc\n- Built-in TLS 1.3 ECC stack. Also can use external TLS libraries - mbedTLS, OpenSSL, or other\n- Does not depend on any other software to implement networking\n- Built-in firmware updates for STM32 H5, STM32 H7\n\nSee https:\u002F\u002Fmongoose.ws\u002F for complete documentation, videos, case studies, etc.\n\n## Supported platforms\n\nMongoose can work on top of any TCP\u002FIP stack that supports BSD sockets API.\nPlatforms supported by the 3rd party TCP\u002FIP stacks:\n\n| TCP\u002FIP stack    | Notes |\n| :-------------- | :------- |\n| **lwIP**        | All devices running lwIP, for example ESP32, ESP32S3, ESP32C3, ESP32C6, etc |\n| **Zephyr**      | All devices supported by Zephyr |\n| **Other**       | Any other TCP\u002FIP stack that supports BSD socket API, for example Amazon FreeRTOS-TCP |\n| **Linux, Mac, Windows**   | Workstations, server, single board computers, embedded Linux devices running on MPUs or FPGAs |\n\nOptionally, Mongoose provides its own built-in TCP\u002FIP stack, eliminating the\nneed for additional software to implement networking functionality. The\nbuilt-in stack supports operation in both bare-metal and RTOS environments.\nPlatforms supported by the Mongoose built-in TCP\u002FIP stack:\n\n| Hardware       | Notes |\n| :------------- | :------- |\n| **STM32**      | All STM32 MCUs with built-in Ethernet: STM32Fxx, STM32H5xx, STM32H7xx |\n| **NXP**        |  All NXP MCUs with built-in Ethernet: IMXRT102x, IMXRT104x, IMXRT105x, IMXRT106x, IMXRT117x, RW612, MCXN94x   |\n| **Microchip**  | ATSAME54 MCUs with built-int Ethernet  |\n| **Renesas**    | RA5M, RA6M, RA8M MCUs with built-in Ethernet    |\n| **Infineon**   | XMC4, XMC7 MCUs with built-in Ethernet    |\n| **Texas Instruments**  |  TM4C, TMS570 MCUs with built-in Ethernet   |\n| **Cypress WiFi**  | Any MCU with CY43xx WiFi chips, like RP2040 Pico-W, RP2350 Pico2-W, Arduino Portenta    |\n| **Wiznet Ethernet**  | Any MCU that use Wiznet W5500 or Wiznet 5100 MAC+PHY chips    |\n| **Cellular**   | NRF9160, SIM800    |\n\n## Usage Examples\n\nBelow are quick snippets that should give an idea how simple the API is and\nhow easy it is to create applications with it.\n\nCreate a simple web server that serves a directory. The behavior of the\nHTTP server is specified by its event handler function:\n\n```c\n#include \"mongoose.h\"   \u002F\u002F To build, run: cc main.c mongoose.c\n\n\u002F\u002F HTTP server event handler function\nvoid ev_handler(struct mg_connection *c, int ev, void *ev_data) {\n  if (ev == MG_EV_HTTP_MSG) {\n    struct mg_http_message *hm = (struct mg_http_message *) ev_data;\n    struct mg_http_serve_opts opts = { .root_dir = \".\u002Fweb_root\u002F\" };\n    mg_http_serve_dir(c, hm, &opts);\n  }\n}\n\nint main(void) {\n  struct mg_mgr mgr;  \u002F\u002F Declare event manager\n  mg_mgr_init(&mgr);  \u002F\u002F Initialise event manager\n  mg_http_listen(&mgr, \"http:\u002F\u002F0.0.0.0:8000\", ev_handler, NULL);  \u002F\u002F Setup listener\n  for (;;) {          \u002F\u002F Run an infinite event loop\n    mg_mgr_poll(&mgr, 1000);\n  }\n  return 0;\n}\n```\n\nHTTP server implements a REST API that returns current time. JSON formatting:\n```c\nstatic void ev_handler(struct mg_connection *c, int ev, void *ev_data) {\n  if (ev == MG_EV_HTTP_MSG) {\n    struct mg_http_message *hm = (struct mg_http_message *) ev_data;\n    if (mg_match(hm->uri, mg_str(\"\u002Fapi\u002Ftime\u002Fget\"), NULL)) {\n      mg_http_reply(c, 200, \"\", \"{%m:%lu}\\n\", MG_ESC(\"time\"), time(NULL));\n    } else {\n      mg_http_reply(c, 500, \"\", \"{%m:%m}\\n\", MG_ESC(\"error\"), MG_ESC(\"Unsupported URI\")); \n    }\n  }\n}\n```\n\nMQTT client that subscribes to a topic `device1\u002Frx` and\nechoes incoming messages to `device1\u002Ftx`:\n\n```c\n#include \"mongoose.h\"\n\nstatic const char *s_mqtt_url = \"mqtt:\u002F\u002Fbroker.hivemq.com:1883\";\nstatic struct mg_connection *s_mqtt_conn = NULL;\n\n\u002F\u002F MQTT connection event handler function\nstatic void ev_handler(struct mg_connection *c, int ev, void *ev_data) {\n  if (ev == MG_EV_OPEN) {\n    MG_INFO((\"%lu created, connecting to %s ...\", c->id, s_mqtt_url));\n  } else if (ev == MG_EV_MQTT_OPEN) {\n    struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str(\"device1\u002Frx\")};\n    mg_mqtt_sub(c, &opts);\n    MG_INFO((\"%lu connected, subscribing to %s\", c->id, opts.topic.buf));\n  } else if (ev == MG_EV_MQTT_MSG) {\n    char response[100];\n    struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;\n    struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str(\"device1\u002Ftx\")};\n    mg_snprintf(response, sizeof(response), \"Received [%.*s] \u002F [%.*s]\",\n                mm->topic.len, mm->topic.buf, mm->data.len, mm->data.buf);\n    opts.message = mg_str(response);\n    mg_mqtt_pub(c, &opts);\n  } else if (ev == MG_EV_CLOSE) {\n    MG_INFO((\"%u closing\", c->id));\n    s_mqtt_conn = NULL;\n  }\n}\n\n\u002F\u002F Reconnection timer function. If we get disconnected, reconnect again\nstatic void timer_fn(void *arg) {\n  struct mg_mgr *mgr = (struct mg_mgr *) arg;\n  if (s_mqtt_conn == NULL) {\n    struct mg_mqtt_opts opts = {.clean = true};\n    s_mqtt_conn = mg_mqtt_connect(mgr, s_mqtt_url, &opts, ev_handler, NULL);\n  }\n}\n\nint main() {\n  struct mg_mgr mgr;  \u002F\u002F Mongoose event manager. Holds all connections\n  mg_mgr_init(&mgr);  \u002F\u002F Initialise event manager\n  mg_timer_add(&mgr, 3000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn, &mgr);\n  for (;;) {\n    mg_mgr_poll(&mgr, 1000);  \u002F\u002F Infinite event loop\n  }\n  return 0;\n}\n```\n\n## Commercial use\n- Mongoose is used by hundreds of businesses, from Fortune500 giants like\n  Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses\n- Used to solve a wide range of business needs, like implementing Web UI\n  interface on devices, RESTful API services, telemetry data exchange, remote\n  control for a product, remote software updates, remote monitoring, and others\n- Deployed to hundreds of millions devices in production environment worldwide\n- See [Case Studies](https:\u002F\u002Fmongoose.ws\u002Fcase-studies\u002F) from our respected\n  customers like [Schneider Electric](https:\u002F\u002Fmongoose.ws\u002Fcase-studies\u002Fschneider-electric\u002F) (industrial automation), [Broadcom](https:\u002F\u002Fmongoose.ws\u002Fcase-studies\u002Fbroadcom\u002F) (semiconductors), [Pilz](https:\u002F\u002Fmongoose.ws\u002Fcase-studies\u002Fpilz\u002F) (industrial automation), and others\n- See [Testimonials](https:\u002F\u002Fmongoose.ws\u002Ftestimonials\u002F) from engineers that integrated Mongoose in their commercial products\n- We provide [Evaluation and Commercial licensing](https:\u002F\u002Fmongoose.ws\u002Flicensing\u002F), [support](https:\u002F\u002Fmongoose.ws\u002Fsupport\u002F), consultancy and [integration\n  services](https:\u002F\u002Fmongoose.ws\u002Fintegration\u002F) - don't hesitate to [contact us](https:\u002F\u002Fmongoose.ws\u002Fcontact\u002F)\n\n\n## Security\n\nWe take security seriously:\n1. Mongoose repository runs a\n  [continuous integration test powered by GitHub](https:\u002F\u002Fgithub.com\u002Fcesanta\u002Fmongoose\u002Factions),\n  which runs through hundreds of unit tests on every commit to the repository.\n  Our [unit tests](https:\u002F\u002Fgithub.com\u002Fcesanta\u002Fmongoose\u002Ftree\u002Fmaster\u002Ftest)\n  are built with modern address sanitizer technologies, which help to find\n  security vulnerabilities early\n2. Mongoose repository is integrated into Google's\n  [oss-fuzz continuous fuzzer](https:\u002F\u002Fbugs.chromium.org\u002Fp\u002Foss-fuzz\u002Fissues\u002Flist?sort=-opened&can=1&q=proj:mongoose)\n  which scans for potential vulnerabilities continuously\n3.  We receive periodic vulnerability reports from the independent security\n  groups like\n  [Cisco Talos](https:\u002F\u002Fwww.cisco.com\u002Fc\u002Fen\u002Fus\u002Fproducts\u002Fsecurity\u002Ftalos.html),\n  [Microsoft Security Response Center](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fmsrc),\n  [MITRE Corporation](https:\u002F\u002Fwww.mitre.org\u002F),\n  [Compass Security](https:\u002F\u002Fwww.compass-security.com\u002Fen\u002F) and others.\n  In case of the vulnerability found, we act according to the industry best\n  practice: hold on to the publication, fix the software and notify all our\n  customers that have an appropriate subscription\n4. Some of our customers (for example NASA)\n  have specific security requirements and run independent security audits,\n  of which we get notified and in case of any issue, act similar to (3).\n\n## How to report security vulnerabilities\n\nPlease send an email to support@cesanta.com, with the full information.\nDo NOT create a github issue.\n\n## Articles\n\nTechnical guides and deep dives into embedded web servers, WebUI integration and embedded networking technologies:\n- [Embedded Web Server: A Comprehensive Guide for Modern Connected Devices](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fembedded-web-server-a-comprehensive-guide-for-modern-connected-devices\u002F)\n- [Building Embedded Web Device Dashboards](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fbuilding-embedded-web-device-dashboard\u002F)\n- [ESP32 Device Dashboard: A Step-by-Step Guide for Developers](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fesp32-device-dashboard\u002F)\n- [How to build an STM32 Web Dashboard](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fstm32-device-dashboard\u002F)\n- [STM32 WebSocket Guide](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fstm32-websocket-guide\u002F)\n- [Web File Manager on STM32, ESP32 and Embedded Linux](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fbuilding-a-web-file-manager-on-stm32-esp32-embedded-linux\u002F)\n- [Web dashboard on Zephyr RTOS](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fweb-dashboard-on-zephyr-rtos\u002F)\n- [Limiting TCP\u002FIP RAM usage on STM32](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Flimiting-tcpip-ram-usage-on-stm32\u002F)\n- [STM32 Ethernet explained](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fstm32-ethernet-explained\u002F)\n- [MQTT on a Microcontroller](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fmqtt-on-a-microcontroller\u002F)\n- [STM32 OTA Firmware Update](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fstm32-ota-firmware-update\u002F)\n- [RP2350 OTA Firmware Update](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Frp2350-ota-firmware-update\u002F)\n- [STM32 Ethernet and caches](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Fstm32-ethernet-and-cache\u002F)\n- [NXP RW612 OTA Firmware Update](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Frw612-ota-firmware-update\u002F)\n- [lwIP vs Mongoose - TCP\u002FIP Stack Integration Benchmark](https:\u002F\u002Fmongoose.ws\u002Farticles\u002Flwip-vs-mongoose-tcpip-stack-integration\u002F)\n\n\n## Contributions\n\nContributions are welcome! Please follow the guidelines below:\n\n- Sign [Cesanta CLA](https:\u002F\u002Fcesanta.com\u002Fcla.html) and send GitHub pull request\n- Make sure that PRs have only one commit, and deal with one issue only\n","Mongoose 是一个嵌入式网络库，支持 TCP\u002FIP 网络栈、MQTT 和 WebSocket 协议。其核心功能包括事件驱动的非阻塞 API，适用于多种协议如 HTTP、TCP、UDP、SNTP 等，并内置了异步 DNS 解析器和 TLS 1.3 ECC 堆栈。该库具有跨平台特性，支持 Linux\u002FUNIX、MacOS、Windows、Android 以及多种微控制器芯片（如 ST、NXP、ESP32 等）。此外，Mongoose 还提供了自有的 TCP\u002FIP 堆栈，可与裸机或 RTOS 系统配合使用，同时也兼容 lwIP、Zephyr 等第三方堆栈。因其小巧的静态和运行时占用空间，Mongoose 非常适合物联网设备、嵌入式系统以及其他需要高效网络通信的应用场景。","2026-06-11 03:05:55","top_language"]