{"id":19591711,"url":"https://github.com/svenvc/mqtt","last_synced_at":"2025-04-27T14:33:25.053Z","repository":{"id":49046939,"uuid":"80058167","full_name":"svenvc/mqtt","owner":"svenvc","description":"Pharo MQTT Client","archived":false,"fork":false,"pushed_at":"2021-06-30T07:45:48.000Z","size":151,"stargazers_count":12,"open_issues_count":1,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T00:41:17.144Z","etag":null,"topics":["iot","mqtt-client","pharo","smalltalk"],"latest_commit_sha":null,"homepage":null,"language":"Smalltalk","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/svenvc.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}},"created_at":"2017-01-25T21:09:18.000Z","updated_at":"2024-11-26T20:58:35.000Z","dependencies_parsed_at":"2022-09-09T03:00:28.667Z","dependency_job_id":null,"html_url":"https://github.com/svenvc/mqtt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenvc%2Fmqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenvc%2Fmqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenvc%2Fmqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenvc%2Fmqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svenvc","download_url":"https://codeload.github.com/svenvc/mqtt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251154496,"owners_count":21544509,"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-client","pharo","smalltalk"],"created_at":"2024-11-11T08:30:28.531Z","updated_at":"2025-04-27T14:33:22.099Z","avatar_url":"https://github.com/svenvc.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MQTT for Pharo\n\n[![CI](https://github.com/svenvc/mqtt/actions/workflows/CI.yml/badge.svg)](https://github.com/svenvc/mqtt/actions/workflows/CI.yml)\n\n## MQTT\n\nMQTT is a light-weight publish/subscribe messaging protocol, originally created around 1998. It is now an official open industry ISO standard. It is perfect for large-scale Internet of Things applications and high performance mobile messaging.\n\nThe publish/subscribe messaging pattern requires a message broker. The broker is responsible for distributing messages to interested clients based on the topic of a message. Parties communicating with each other over MQTT would all be clients in different roles, like producers and consumers, using the broker as middleware.\n\nMany client libraries for different programming languages and multiple brokers/servers are available.\n\n## MQTT for Pharo\n\nThis project implements a modern, documented and readable MQTT client library for Pharo.\n\nThe official specification is quite readable and there is a lot of information available (see the References/Links section at the end).\n\nRight now, the following features are available:\n\n - reading \u0026 writing of all 14 binary packet types\n - support for connection open/close, ping, subscribe/unsubscribe, QoS levels 0 (at most once), 1 (at least once) and 2 (exactly once) for application (publish) messages in both directions, message/package IDs and keep alive (heartbeat)\n - use of an inbox when reading messages to store unexpected out of band messages, reading messages with a condition filter, handling keepalive and ping, programming in event driven style using #runWith:\n - unit tests, for packet reading/writing and for clients against 3 publicly available sandbox/test brokers as well as against a local server\n - support for MQTT version 3.1.1\n \n## Usage\n\nSend a single message to a topic to the local broker, say a temperature reading of a sensor, using QoS level 1.\n\n````\nMQTTClient new\n    atLeastOnce;\n    open;\n    sendMessage: 20 asByteArray toTopic: '/device/42/outside-temperature';\n    close.\n````\n\nSame message to a remote host, using the default QoS level 0.\n\n````\nMQTTClient new\n    host: 'iot.example.com';\n    open;\n    sendMessage: 21 asByteArray toTopic: '/device/42/outside-temperature';\n    close.\n````\n\nRead a single message, using QoS level 2 (client should be closed afterwards)\n\n````\nMQTTClient new\n    exactlyOnce;\n    open;\n    subscribeToTopic: '/new-user-notifications';\n    readMessage.\n````\n\nRead and collect 10 temperature readings \n\n````\nArray streamContents: [ :stream | | count |\n    count := 1.\n    MQTTClient new\n       open;\n       subscribeToTopic: '/device/42/outside-temperature';\n       runWith: [ :message |\n         stream nextPut: message contents asInteger.\n         (count := count + 1) \u003e 10 ifTrue: [ ConnectionClosed signal ] ] ].\n````\n\nCollect 100 system notifications\n\n````\nArray streamContents: [ :stream | | count |\n    count := 1.\n    MQTTClient new\n      host: 'iot.eclipse.org';\n      open;\n      subscribeToTopic: '$SYS/#';\n      runWith: [ :message |\n        stream nextPut: message.\n        (count := count + 1) \u003e 100 ifTrue: [ ConnectionClosed signal ] ] ].\n````\n\n## Code\n\nRight now, documentation is limited to class comments and the most important public API methods. The unit test show usage. There is a BaselineOf that load the 3 packages. There are no dependencies.\n\n```Smalltalk\nMetacello new\n  repository: 'github://svenvc/mqtt/repository';\n  baseline: 'MQTT';\n  load.\n```\n\n## References/Links\n\n- [http://mqtt.org](http://mqtt.org)\n- [https://en.wikipedia.org/wiki/MQTT](https://en.wikipedia.org/wiki/MQTT])\n- [http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html])\n- [https://github.com/mqtt/mqtt.github.io/wiki/software](https://github.com/mqtt/mqtt.github.io/wiki/software)\n- [http://mosquitto.org](http://mosquitto.org)\n- [https://github.com/emqtt/emqttd](https://github.com/emqtt/emqttd)\n- [http://kamilfb.github.io/mqtt-spy/](http://kamilfb.github.io/mqtt-spy/)\n- [https://github.com/eclipse/paho.mqtt-spy/wiki](https://github.com/eclipse/paho.mqtt-spy/wiki)\n- [https://eclipse.org/paho/](https://eclipse.org/paho/)\n- [https://eclipse.org/paho/clients/c/embedded/](https://eclipse.org/paho/clients/c/embedded/)\n- [http://www.rabbitmq.com/mqtt.html](http://www.rabbitmq.com/mqtt.html)\n- [https://vernemq.com](https://vernemq.com)\n- [https://www.ibm.com/developerworks/community/blogs/c565c720-fe84-4f63-873f-607d87787327/entry/mqtt_security](https://www.ibm.com/developerworks/community/blogs/c565c720-fe84-4f63-873f-607d87787327/entry/mqtt_security)\n- [http://www.hivemq.com/mqtt-essentials/](http://www.hivemq.com/mqtt-essentials/)\n\n## Sandbox/test Servers/Brokers\n- iot.eclipse.org:1883\n- test.mosquitto.org:1883\n- broker.mqtt-dashboard.com:1883\n- localhost:1883\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenvc%2Fmqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvenvc%2Fmqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenvc%2Fmqtt/lists"}