All Projects → hyper-systems → ocaml-mqtt

hyper-systems / ocaml-mqtt

Licence: other
MQTT client for OCaml/ReasonML

Programming Languages

ocaml
1615 projects
CSS
56736 projects

Projects that are alternatives of or similar to ocaml-mqtt

hello-ppx-esy
A simple example of a ppx with Reason and esy
Stars: ✭ 38 (+171.43%)
Mutual labels:  reasonml
rebez
Cubic bezier implementation in Reason / OCaml.
Stars: ✭ 31 (+121.43%)
Mutual labels:  reasonml
zwave-core
Flexible Z-Wave Service Server - Access your Z-Wave nodes fast and independent - Planned/supported: REST-API, Browser UI, MQTT* - Perfect for maintaining big node-numbers, drop-in ozwcp replacement!
Stars: ✭ 19 (+35.71%)
Mutual labels:  mqtt
bs-Zarith
Support Bigint, Q (rational numbers) and Z (integer numbers) in BuckleScript.
Stars: ✭ 15 (+7.14%)
Mutual labels:  reasonml
bs-css-core
BuckleScript statically typed DSL for CSS (forked from https://github.com/SentiaAnalytics/bs-css)
Stars: ✭ 15 (+7.14%)
Mutual labels:  reasonml
ESP8266 mqtts
Arduino IDE project: send data from DS18B20 temperature sensor to mqtt.flespi.io via MQTT over SSL.
Stars: ✭ 16 (+14.29%)
Mutual labels:  mqtt
reasonml-minimal-config
ReasonML minimal webpack config with webpack-dashboard & reports enabled
Stars: ✭ 16 (+14.29%)
Mutual labels:  reasonml
dokusho
Simple Japanese reading stats tracker
Stars: ✭ 12 (-14.29%)
Mutual labels:  reasonml
bs-downshift
BuckleScript bindings for Downshift
Stars: ✭ 21 (+50%)
Mutual labels:  reasonml
mqttools
MQTT version 5.0 client and broker using asyncio
Stars: ✭ 44 (+214.29%)
Mutual labels:  mqtt
reason-catstagram
🐈 Catstagram made with ReasonReact!
Stars: ✭ 31 (+121.43%)
Mutual labels:  reasonml
rescript-jest
ReScript bindings for Jest
Stars: ✭ 274 (+1857.14%)
Mutual labels:  reasonml
102shows
Raspberry Pi + APA102 + MQTT + 102shows = LED awesomeness!
Stars: ✭ 15 (+7.14%)
Mutual labels:  mqtt
reactor
🚀 Native Actors for Reason and OCaml
Stars: ✭ 70 (+400%)
Mutual labels:  reasonml
reason-phoenix
ReasonML/ReScript bindings for the Phoenix javascript library
Stars: ✭ 14 (+0%)
Mutual labels:  reasonml
Reason-react-hooks
🧶 Some hooks in ReasonML for reason-react that can be useful
Stars: ✭ 14 (+0%)
Mutual labels:  reasonml
qnd
Quick and Dirty development builds
Stars: ✭ 19 (+35.71%)
Mutual labels:  reasonml
ccu-addon-mosquitto
Mosquitto packaged as Addon for the Homematic CCU3 and RaspberryMatic
Stars: ✭ 23 (+64.29%)
Mutual labels:  mqtt
homely
🏠 - A bunch of mosquittos. IoT wiring and notification framework, with an unix style.
Stars: ✭ 15 (+7.14%)
Mutual labels:  mqtt
bs-lwt
BuckleScript bindings for Lwt
Stars: ✭ 26 (+85.71%)
Mutual labels:  reasonml

OCaml MQTT Client

OCaml-CI Build Status

This library implements the client MQTT v3 protocol.

Originally forked from https://github.com/j0sh/ocaml-mqtt.

Quickstart

To install ocaml-mqtt in an esy project, add the following dependency to your package.json file:

"dependencies": {
  "ocaml-mqtt": "odis-labs/ocaml-mqtt#3a97e01"
}

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:

open Printf;

let sub_example = () => {
  let%lwt client = Mqtt_client.connect(~id="client-1", ~port, [host]);
  let%lwt () = Mqtt_client.subscribe([("topic-1", Mqtt_client.Atmost_once)], client);
  let stream = Mqtt_client.messages(client);
  let rec loop = () => {
    let%lwt msg = Lwt_stream.get(stream);
    switch(msg) {
      | None => Lwt_io.printl("STREAM FINISHED")
      | Some((topic, payload)) =>
        printlf("%s: %s", topic, payload);
        loop()
    };
  };
  loop();
};
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].