{"id":17526643,"url":"https://github.com/dzavalishin/mqtt_udp","last_synced_at":"2025-03-06T06:30:37.938Z","repository":{"id":27628340,"uuid":"114698912","full_name":"dzavalishin/mqtt_udp","owner":"dzavalishin","description":"Simpified version of MQTT over UDP","archived":false,"fork":false,"pushed_at":"2023-10-19T18:46:17.000Z","size":11782,"stargazers_count":141,"open_issues_count":39,"forks_count":32,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-30T02:32:44.236Z","etag":null,"topics":["iot","mqtt","mqtt-udp","udp"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/dzavalishin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2017-12-18T23:47:38.000Z","updated_at":"2024-10-23T01:24:33.000Z","dependencies_parsed_at":"2024-04-26T15:33:12.658Z","dependency_job_id":null,"html_url":"https://github.com/dzavalishin/mqtt_udp","commit_stats":{"total_commits":738,"total_committers":2,"mean_commits":369.0,"dds":"0.0013550135501354532","last_synced_commit":"8796493eba0487a1280ab2ae346fdf8c5e2857ec"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzavalishin%2Fmqtt_udp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzavalishin%2Fmqtt_udp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzavalishin%2Fmqtt_udp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzavalishin%2Fmqtt_udp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzavalishin","download_url":"https://codeload.github.com/dzavalishin/mqtt_udp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242161226,"owners_count":20081828,"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":["iot","mqtt","mqtt-udp","udp"],"created_at":"2024-10-20T15:02:08.973Z","updated_at":"2025-03-06T06:30:37.930Z","avatar_url":"https://github.com/dzavalishin.png","language":"Java","funding_links":[],"categories":["Java","网络编程"],"sub_categories":["语音合成"],"readme":"# MQTT/UDP\nSimpified version of MQTT over UDP: Network is broker!\n\nNote other repo: https://gitverse.ru/dzavalishin/mqtt_udp\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c498fc36dbea4e41a05f4ba5a8c0ff96)](https://www.codacy.com/app/dzavalishin/mqtt_udp?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=dzavalishin/mqtt_udp\u0026amp;utm_campaign=Badge_Grade) \n[![Build Status](https://travis-ci.org/dzavalishin/mqtt_udp.svg?branch=master)](https://travis-ci.org/dzavalishin/mqtt_udp) \n[![Documentation Status](https://readthedocs.org/projects/mqtt-udp/badge/?version=latest)](https://mqtt-udp.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/mqttudp.svg)](https://badge.fury.io/py/mqttudp)\n\n[See Russian version / Русская версия здесь](./README.ru.md)\n\nMQTT is a cute simple protocol well suited for IoT and similar things.\n\nBut it can be even simpler and still be very usable: MQTT/UDP is\nmerely an MQTT Publish packets broadcast over an UDP.\n\n## MQTT/UDP is \n\n*   Extremely simple\n*   Extremely fast, minimal possible latency\n*   Excludes broker (which is single point of failure)\n*   Lowers network traffic (each masurement is sent exactly once to all)\n*   Reasonably reliable (if we use it for sensors, which usually resend data every few seconds or so)\n*   Can be supported even on a hardware which can not support TCP - in fact, only UDP send is required\n*   Zero configuration - a sensor node needs no setup, it just broadcasts its data. (And, if you still need it, MQTT/UDP supports remote configuration over network.)\n*   Supports digital signature\n\n## For further reading\n\n*   [MQTT/UDP Wiki](../../wiki)\n*   [Documentation](https://mqtt-udp.readthedocs.io/en/latest/)\n\n## This repository contains\n\n*   A simple MQTT/UDP implementation in some popular programming languages.\n*   A simplest MQTT to MQTT/UDP bridge implementation in Pyton.\n*   A tool to send data from MQTT/UDP to OpenHAB \n*   A [debug application](https://github.com/dzavalishin/mqtt_udp/wiki/MQTT-UDP-Viewer-Help) to dump MQTT/UDP traffic ([tools/viewer](tools/viewer)).\n*   Other tools and utilities\n\n## If you want to help a project\n\nFeel free to:\n\n*   Add implementation in your favorite programming language\n*   Write a bridge to classic MQTT protocol (we have very simple one here written in Python)\n*   Extend your favorite MQTT broker or IoT system (OpenHAB?) with MQTT/UDP support\n*   Check MQTT/UDP specification/implementation against MQTT spec. We must be compatible where possible.\n\nIt is really easy.\n\n## Reasons to avoid MQTT/UDP\n\n*   You need to transfer long payloads. On some systems size of UDP datagram is limited.\n*   You need to know if datagram was delivered for sure. It is impossible with UDP. Though, reliable delivery subsystem is being in development now and will be available soon.\n\n## Ways to extend MQTT/UDP\n\n*   It seems to be reasonable to add some kind of signature to packets to prevent data spoofing. Actually, it is already done for Java implementation, C and Pythin will come soon.\n*   Broadcast is not the best way to transmit data. Multicast is much better. Though multicast is not so well supported in IoT OS's or monitors.\n\n## Fast start instructions\n\n*   Clone repository to local disk\n*   Read [HOWTO](https://raw.githubusercontent.com/dzavalishin/mqtt_udp/master/HOWTO) file\n\n## Support tools\n\nThis repository contains tools to support MQTT/UDP integration and test:\n\n*   GUI tool to show current state of data transmitted in [tools/viewer](https://github.com/dzavalishin/mqtt_udp/tree/master/tools/viewer) directory; see also [viewer help page](https://github.com/dzavalishin/mqtt_udp/wiki/MQTT-UDP-Viewer-Help).\n*   Random data generator (random_to_udp.py) in [python3/examples](https://github.com/dzavalishin/mqtt_udp/tree/master/python3/examples) directory\n*   Send/check tool for sequentially numbered packets. See seq_storm_send.py and seq_storm_check.py in [lang/python3/examples](https://github.com/dzavalishin/mqtt_udp/tree/master/python3/examples) directory\n*   WireShark dissector to see protocol data on the network in [lang/lua/wireshark](https://github.com/dzavalishin/mqtt_udp/tree/master/lua/wireshark) directory\n\n\n## Code examples\n\n### Python\n\n**Send data:**\n\n```python\nimport mqttudp.engine\n\nif __name__ == \"__main__\":\n    mqttudp.engine.send_publish( \"test_topic\", \"Hello, world!\" )\n```\n\n**Listen for data:**\n\n```python\nimport mqttudp.engine\n\ndef recv_packet(ptype,topic,value,pflags,addr):\n    if ptype != \"publish\":\n        print( ptype + \", \" + topic + \"\\t\\t\" + str(addr) )\n        return\n    print( topic+\"=\"+value+ \"\\t\\t\" + str(addr) )\n\nif __name__ == \"__main__\":\n    mqttudp.engine.listen(recv_packet)\n```\n\nDownload [pypi package](https://pypi.org/project/mqttudp/)\n\n### Java\n\n**Send data:**\n\n```java\nPublishPacket pkt = new PublishPacket(topic, value);\npkt.send();\n\n```\n\n**Listen for data:**\n\n\n```java\nPacketSourceServer ss = new PacketSourceServer();\nss.setSink( pkt -\u003e { System.out.println(\"Got packet: \"+pkt); });\n\n```\n\nDownload [JAR](https://github.com/dzavalishin/mqtt_udp/blob/master/build/mqtt_udp-0.4.1.jar)\n\n### C\n\n**Send data:**\n\n```c\nint rc = mqtt_udp_send_publish( topic, value );\n\n```\n\n**Listen for data:**\n\n```c\n\nint main(int argc, char *argv[])\n{\n    ...\n\n    int rc = mqtt_udp_recv_loop( mqtt_udp_dump_any_pkt );\n\n    ...\n}\n\nint mqtt_udp_dump_any_pkt( struct mqtt_udp_pkt *o )\n{\n\n    printf( \"pkt %x flags %x, id %d\",\n            o-\u003eptype, o-\u003epflags, o-\u003epkt_id\n          );\n\n    if( o-\u003etopic_len \u003e 0 )\n        printf(\" topic '%s'\", o-\u003etopic );\n\n    if( o-\u003evalue_len \u003e 0 )\n        printf(\" = '%s'\", o-\u003evalue );\n\n    printf( \"\\n\");\n}\n\n\n```\n\n\n### Lua\n\n\n**Send data:**\n\n\n```lua\nlocal mq = require \"mqtt_udp_lib\"\nmq.publish( topic, val );\n\n```\n\n**Listen for data:**\n\n\n```lua\nlocal mq = require \"mqtt_udp_lib\"\n\nlocal listener = function( ptype, topic, value, ip, port )\n    print(\"'\"..topic..\"' = '\"..val..\"'\"..\"\tfrom: \", ip, port)\nend\n\nmq.listen( listener )\n```\n\nDownload [LuaRock](http://luarocks.org/modules/dzavalishin/mqttudp)\n\n\n### Go\n\nThere is a Go language implementation, see lang/go for details\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzavalishin%2Fmqtt_udp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzavalishin%2Fmqtt_udp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzavalishin%2Fmqtt_udp/lists"}