package mqtt
All checked builds pass sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
OCaml MQTT client
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.2.2.tar.gz
md5=1af0b40f0d73e2ed69b515a7c43d2e5f
sha512=f2640262b929bece15b51abd3bfcd708eb495fb7371c23e30c2a69f12a1633385d8de90153ee11aaeacb71b3f782f59b3a2f1ce9d783b20c959d9ce6f2f9d96a
Description
Added to opam-repository:
README
OCaml MQTT Client
This library implements the client MQTT v3 protocol.
Quickstart
In your dune project add the following dependencies to your dune file:
(executable
(name My_app)
(public_name my_app)
(libraries mqtt.client lwt)
(preprocess (pps lwt_ppx)))Examples
Here is a basic example of a subscriber:
module C = Mqtt_client
let host = "127.0.0.1"
let port = 1883
let sub_example () =
let on_message ~topic payload = Lwt_io.printlf "%s: %s" topic payload in
let%lwt () = Lwt_io.printl "Starting subscriber..." in
let%lwt client = C.connect ~on_message ~id:"client-1" ~port [ host ] in
C.subscribe [ ("topic-1", C.Atmost_once) ] client
let pub_example () =
let%lwt () = Lwt_io.printl "Starting publisher..." in
let%lwt client = C.connect ~id:"client-1" ~port [ host ] in
let rec loop () =
let%lwt () = Lwt_io.printl "Publishing..." in
let%lwt line = Lwt_io.read_line Lwt_io.stdin in
let%lwt () = C.publish ~qos:C.Atleast_once ~topic:"topic-1" line client in
let%lwt () = Lwt_io.printl "Published." in
loop ()
in
loop ()
let () = Lwt_main.run (sub_example ())
Dependencies (9)
Dev Dependencies (7)
-
odoc
with-doc & >= "2.4.1" -
ocamlformat
with-dev-setup & >= "0.26.1" -
ocaml-lsp-server
with-dev-setup -
cohttp-lwt-unix
with-test & >= "5.0.0" -
cohttp
with-test & >= "5.0.0" -
alcotest-lwt
with-test & >= "1.5.0" -
alcotest
with-test & >= "1.5.0"
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building mqtt with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.2.2 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page