{"id":13698692,"url":"https://github.com/LiamBindle/MQTT-C","last_synced_at":"2025-05-04T03:31:52.153Z","repository":{"id":30488323,"uuid":"125110883","full_name":"LiamBindle/MQTT-C","owner":"LiamBindle","description":"A portable MQTT C client for embedded systems and PCs alike.","archived":false,"fork":false,"pushed_at":"2024-05-12T05:19:51.000Z","size":1129,"stargazers_count":755,"open_issues_count":31,"forks_count":268,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-08-02T19:01:46.765Z","etag":null,"topics":["c","mqtt","mqtt-client","portable","publisher-subscriber","simple"],"latest_commit_sha":null,"homepage":"https://liambindle.ca/MQTT-C","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiamBindle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-13T20:33:03.000Z","updated_at":"2024-08-01T07:17:02.000Z","dependencies_parsed_at":"2024-05-02T00:53:16.871Z","dependency_job_id":"1cdcab71-ce16-4835-a762-096351b65bb8","html_url":"https://github.com/LiamBindle/MQTT-C","commit_stats":{"total_commits":239,"total_committers":34,"mean_commits":7.029411764705882,"dds":0.6401673640167365,"last_synced_commit":"7a986a68ebea63921d4aab20a9d1b26a8b5f8c9d"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiamBindle%2FMQTT-C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiamBindle%2FMQTT-C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiamBindle%2FMQTT-C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiamBindle%2FMQTT-C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiamBindle","download_url":"https://codeload.github.com/LiamBindle/MQTT-C/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224383726,"owners_count":17302250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","mqtt","mqtt-client","portable","publisher-subscriber","simple"],"created_at":"2024-08-02T19:00:51.943Z","updated_at":"2024-11-13T03:31:21.773Z","avatar_url":"https://github.com/LiamBindle.png","language":"C","funding_links":[],"categories":["Networking","Clients","Networking and Internet","C","网络和互联网","内存分配","Networking and Internet ##","Protocol Library"],"sub_categories":["C or C++","Advanced books","高级书籍","网络","Physical ###","MQTT"],"readme":"\u003cp align=\"right\"\u003e\n    \u003ca href=\"https://github.com/LiamBindle/MQTT-C/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/LiamBindle/MQTT-C.svg?style=social\u0026label=Star\" style=\"margin-left:5em\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/LiamBindle/MQTT-C/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/LiamBindle/MQTT-C.svg?style=social\u0026label=Fork\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=\"70%\" src=\"docs/mqtt-c-logo.png\"\u003e\u003cbr\u003e\n    \u003ca href=\"https://liambindle.ca/MQTT-C\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-passing-brightgreen.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/LiamBindle/MQTT-C/issues\"\u003e\u003cimg src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://GitHub.com/LiamBindle/MQTT-C/issues/\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/LiamBindle/MQTT-C.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/LiamBindle/MQTT-C/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-closed/LiamBindle/MQTT-C.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/LiamBindle/MQTT-C/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nMQTT-C is an [MQTT v3.1.1](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html) \nclient written in C. MQTT is a lightweight publisher-subscriber-based messaging protocol that is\ncommonly used in IoT and networking applications where high-latency and low data-rate links \nare expected. The purpose of MQTT-C is to provide a **portable** MQTT client, **written in C**, \nfor embedded systems and PC's alike. MQTT-C does this by providing a transparent Platform \nAbstraction Layer (PAL) which makes porting to new platforms easy. MQTT-C is completely \nthread-safe but can also run perfectly fine on single-threaded systems making MQTT-C \nwell-suited for embedded systems and microcontrollers. Finally, MQTT-C is small; there are only \ntwo source files totalling less than 2000 lines.\n\n#### A note from the author\nIt's been great to hear about all the places MQTT-C is being used! Please don't hesitate\nto get in touch with me or submit issues on GitHub!\n\n## Getting Started\nTo use MQTT-C you first instantiate a `struct mqtt_client` and initialize it by calling\n@ref mqtt_init.\n```c\n    struct mqtt_client client; /* instantiate the client */\n    mqtt_init(\u0026client, ...);   /* initialize the client */\n```\nOnce your client is initialized you need to connect to an MQTT broker.\n```c\n    mqtt_connect(\u0026client, ...); /* send a connection request to the broker. */\n```\nAt this point the client is ready to use! For example, we can subscribe to a topic like so:\n```c\n    /* subscribe to \"toaster/temperature\" with a max QoS level of 0 */\n    mqtt_subscribe(\u0026client, \"toaster/temperature\", 0);\n```\nAnd we can publish to a topic like so:\n```c\n    /* publish coffee temperature with a QoS level of 1 */\n    int temperature = 67;\n    mqtt_publish(\u0026client, \"coffee/temperature\", \u0026temperature, sizeof(int), MQTT_PUBLISH_QOS_1);\n```\nThose are the basics! From here the [examples](https://github.com/LiamBindle/MQTT-C/tree/master/examples) and [API documentation](https://liambindle.ca/MQTT-C/group__api.html) are good places to get started.\n\n## Building\nThere are **only two source files** that need to be built, `mqtt.c` and `mqtt_pal.c`.\nThese files are ANSI C (C89) compatible, and should compile with any C compiler.\n\nThen, simply \u003ccode\u003e\\#include \u003cmqtt.h\u003e\u003c/code\u003e.\n\nAlternatively, you can build MQTT-C with CMake or the provided Makefile. These are provided for convenience.\n\n## Documentation\nPre-built documentation can be found here: [https://liambindle.ca/MQTT-C](https://liambindle.ca/MQTT-C). Be sure to check out the [examples](https://github.com/LiamBindle/MQTT-C/tree/master/examples) too.\n\nThe @ref api documentation contains all the documentation application programmers should need. \nThe @ref pal documentation contains everything you should need to port MQTT-C to a new platform,\nand the other modules contain documentation for MQTT-C developers.\n\n## Testing and Building the Tests\nThe MQTT-C unit tests use the [cmocka unit testing framework](https://cmocka.org/). \nTherefore, [cmocka](https://cmocka.org/) *must* be installed on your machine to build and run \nthe unit tests. For convenience, a simple `\"makefile\"` is included to build the unit tests and \nexamples on UNIX-like machines. The unit tests and examples can be built as follows:\n```bash\n    $ make all\n``` \nThe unit tests and examples will be built in the `\"bin/\"` directory. The unit tests can be run \nlike so:\n```bash\n    $ ./bin/tests [address [port]]\n```\nNote that the \\c address and \\c port arguments are both optional to specify the location of the\nMQTT broker that is to be used for the tests. If no \\c address is given then the \n[Mosquitto MQTT Test Server](https://test.mosquitto.org/) will be used. If no \\c port is given, \nport 1883 will be used.\n\n## Portability\nMQTT-C provides a transparent platform abstraction layer (PAL) in `mqtt_pal.h` and `mqtt_pal.c`.\nThese files declare and implement the types and calls that MQTT-C requires. Refer to \n@ref pal for the complete documentation of the PAL.\n\n## Contributing\nPlease feel free to submit issues and pull-requests [here](https://github.com/LiamBindle/MQTT-C).\nWhen submitting a pull-request please ensure you have *fully documented* your changes and \nadded the appropriate unit tests.\n\n\n## License\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the \n`\"LICENSE\"` file for more details.\n\n## Authors\nMQTT-C was initially developed as a CMPT 434 (Winter Term, 2018) final project at the University of \nSaskatchewan by:\n- **Liam Bindle**\n- **Demilade Adeoye**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLiamBindle%2FMQTT-C","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLiamBindle%2FMQTT-C","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLiamBindle%2FMQTT-C/lists"}