{"id":24232505,"url":"https://github.com/hyper-systems/ocaml-mqtt","last_synced_at":"2025-09-23T01:31:06.168Z","repository":{"id":40405104,"uuid":"236806333","full_name":"hyper-systems/ocaml-mqtt","owner":"hyper-systems","description":"MQTT client for OCaml","archived":false,"fork":false,"pushed_at":"2024-04-06T21:48:22.000Z","size":991,"stargazers_count":23,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T08:23:37.814Z","etag":null,"topics":["iot","mqtt","ocaml","protocol"],"latest_commit_sha":null,"homepage":"https://hyper-systems.github.io/ocaml-mqtt","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyper-systems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-01-28T18:19:31.000Z","updated_at":"2025-04-04T10:33:07.000Z","dependencies_parsed_at":"2023-11-07T02:13:03.801Z","dependency_job_id":"c62df06f-3a52-4f71-91f7-123acf291627","html_url":"https://github.com/hyper-systems/ocaml-mqtt","commit_stats":null,"previous_names":["hyper-systems/ocaml-mqtt-client","hyper-systems/ocaml-mqtt"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hyper-systems/ocaml-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper-systems%2Focaml-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper-systems%2Focaml-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper-systems%2Focaml-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper-systems%2Focaml-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyper-systems","download_url":"https://codeload.github.com/hyper-systems/ocaml-mqtt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper-systems%2Focaml-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276502707,"owners_count":25653732,"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","status":"online","status_checked_at":"2025-09-22T02:00:08.972Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ocaml","protocol"],"created_at":"2025-01-14T15:30:19.045Z","updated_at":"2025-09-23T01:31:06.136Z","avatar_url":"https://github.com/hyper-systems.png","language":"OCaml","funding_links":[],"categories":["\u003ca name=\"OCaml\"\u003e\u003c/a\u003eOCaml"],"sub_categories":[],"readme":"# OCaml MQTT Client\n\n[![OCaml-CI Build Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Fhyper-systems%2Focaml-mqtt%2Fmaster\u0026logo=ocaml)](https://ci.ocamllabs.io/github/hyper-systems/ocaml-mqtt)\n\nThis library implements the client MQTT v3 protocol.\n\n* [API Documentation](https://hyper.systems/ocaml-mqtt/mqtt/index.html)\n* [Issues](https://github.com/hyper-systems/ocaml-mqtt/issues)\n\n\u003e Originally forked from https://github.com/j0sh/ocaml-mqtt.\n\n## Quickstart\n\nInstall the packaage:\n```\n$ opam install mqtt\n```\n\nIn your dune project add the following dependencies to your dune file:\n```lisp\n(executable\n  (name My_app)\n  (public_name my_app)\n  (libraries mqtt.client lwt)\n  (preprocess (pps lwt_ppx)))\n```\n\n## Examples\n\nHere is a basic example of a subscriber:\n```ocaml\nmodule C = Mqtt_client\n\nlet host = \"127.0.0.1\"\nlet port = 1883\n\nlet sub_example () =\n  let on_message ~topic payload = Lwt_io.printlf \"%s: %s\" topic payload in\n  let%lwt () = Lwt_io.printl \"Starting subscriber...\" in\n  let%lwt client = C.connect ~on_message ~id:\"client-1\" ~port [ host ] in\n  C.subscribe [ (\"topic-1\", C.Atmost_once) ] client\n\nlet pub_example () =\n  let%lwt () = Lwt_io.printl \"Starting publisher...\" in\n  let%lwt client = C.connect ~id:\"client-1\" ~port [ host ] in\n  let rec loop () =\n    let%lwt () = Lwt_io.printl \"Publishing...\" in\n    let%lwt line = Lwt_io.read_line Lwt_io.stdin in\n    let%lwt () = C.publish ~qos:C.Atleast_once ~topic:\"topic-1\" line client in\n    let%lwt () = Lwt_io.printl \"Published.\" in\n    loop ()\n  in\n  loop ()\n\nlet () = Lwt_main.run (sub_example ())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper-systems%2Focaml-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyper-systems%2Focaml-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper-systems%2Focaml-mqtt/lists"}