{"id":15056351,"url":"https://github.com/jhillyerd/gemqtt","last_synced_at":"2025-10-30T21:50:35.330Z","repository":{"id":225416392,"uuid":"764337922","full_name":"jhillyerd/gemqtt","owner":"jhillyerd","description":"emqx/emqtt client wrapper for Gleam","archived":false,"fork":false,"pushed_at":"2024-10-01T16:02:23.000Z","size":86,"stargazers_count":3,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T04:07:03.456Z","etag":null,"topics":["erlang","gleam","mqtt","mqtt-client"],"latest_commit_sha":null,"homepage":"","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhillyerd.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":"2024-02-27T22:31:05.000Z","updated_at":"2024-10-01T15:58:05.000Z","dependencies_parsed_at":"2024-03-11T23:29:55.570Z","dependency_job_id":"51bdde6e-b09e-477a-9b54-604fff5fd2c2","html_url":"https://github.com/jhillyerd/gemqtt","commit_stats":null,"previous_names":["jhillyerd/gemqtt"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhillyerd%2Fgemqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhillyerd%2Fgemqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhillyerd%2Fgemqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhillyerd%2Fgemqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhillyerd","download_url":"https://codeload.github.com/jhillyerd/gemqtt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154984,"owners_count":21056543,"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":["erlang","gleam","mqtt","mqtt-client"],"created_at":"2024-09-24T21:50:04.383Z","updated_at":"2025-10-30T21:50:30.285Z","avatar_url":"https://github.com/jhillyerd.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gemqtt\n\n[![Package Version](https://img.shields.io/hexpm/v/gemqtt)](https://hex.pm/packages/gemqtt)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gemqtt/)\n\ngemqtt provides an MQTT client for Gleam projects running on the BEAM.  It does\nso by wrapping the [emqx/emqtt] library written in Erlang.\n\n## NOTE\n\nAt the time of writing (March 19th, 2024), this package is stuck on emqtt\nversion 1.2 due to a [dependency\nissue](https://github.com/jhillyerd/gemqtt/issues/21). That version of the\nunderlying [emqx/emqtt] library only works with Erlang OTP version 25.x, not\n26+.\n\n## Status\n\nThis package is a work in progress. If it is missing an emqtt feature you need,\nplease send a PR.\n\n### General features\n\n- [x] Connect to unencrypted MQTT servers over TCP\n- [x] Connect to TLS encrypted MQTT servers over TCP\n- [ ] Connect to unencrypted MQTT servers over websocket\n- [ ] Connect to TLS encrypted MQTT servers over websocket\n- [x] Supports [emqtt properties] for connect, publish, and subscribe\n\n### Connect options\n\n- [x] User + password authentication\n- [x] Message auto acknowledgement\n- [x] Clean start\n- [x] Client ID\n- [x] Connect timeout\n- [x] Erlang server name\n- [x] Owner PID (for disconnect notifications)\n- [x] Port number\n- [x] TLS enable + raw options\n- [ ] TCP options\n- [ ] Websocket path\n- [ ] Bridge mode\n- [ ] Proto version\n- [ ] Keep alive\n- [ ] Max in-flight\n- [ ] Retry interval\n- [ ] Will topic\n- [ ] Will payload\n- [ ] Will retain\n- [ ] Will QoS\n- [ ] Will properties\n- [ ] Ack timeout\n- [ ] Force ping\n\n### Publish options\n\n- [x] QoS\n- [x] Retain\n\n### Subscribe options\n\n- [x] Local Echo\n- [x] QoS\n- [x] Retain as published\n- [x] Retain handling\n\n## Example Usage\n\n```sh\ngleam add gleam_erlang\ngleam add gemqtt\n```\n```gleam\nimport gemqtt\nimport gemqtt/publisher\nimport gemqtt/subscriber\nimport gleam/bit_array\nimport gleam/erlang/process\nimport gleam/io\n\npub fn main() {\n  let topic = \"gemqtt/readme/example\"\n\n  // Create a client and connect to the test server.\n  let assert Ok(client) =\n    gemqtt.new(\"test.mosquitto.org\")\n    |\u003e gemqtt.start_link\n  let assert Ok(_) = gemqtt.connect(client)\n\n  io.println(\"Connected.\")\n\n  // Subscribe to messages from the topic.\n  let assert Ok(_) =\n    client\n    |\u003e subscriber.new\n    |\u003e subscriber.add(topics: [topic])\n\n  io.println(\"Subscribed.\")\n\n  // Publish a test message to the topic.\n  let assert Ok(_) =\n    publisher.new(client, topic)\n    |\u003e publisher.publish(bit_array.from_string(\"Hello from Gleam!\"))\n\n  io.println(\"Sent message.\")\n\n  // Attempt to receive a message from the topic.\n  let assert Ok(got_msg) =\n    process.new_selector()\n    |\u003e subscriber.selecting_mqtt_messages(Ok)\n    |\u003e process.select_forever\n\n  io.println(\"Received message:\")\n  io.debug(got_msg)\n\n  let assert Ok(_) = subscriber.remove(client, [topic])\n  let assert Ok(_) = gemqtt.disconnect(client)\n}\n```\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/gemqtt\u003e.\n\n## Development\n\n```sh\ngleam test  # Run the tests\ngleam shell # Run an Erlang shell\n```\n\n\n[emqx/emqtt]:       https://github.com/emqx/emqtt\n[emqtt properties]: https://github.com/emqx/emqtt?tab=readme-ov-file#properties\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhillyerd%2Fgemqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhillyerd%2Fgemqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhillyerd%2Fgemqtt/lists"}