https://github.com/c-cube/micronats.ml
Small NATS client for OCaml + Eio
https://github.com/c-cube/micronats.ml
eio nats ocaml pubsub
Last synced: 6 days ago
JSON representation
Small NATS client for OCaml + Eio
- Host: GitHub
- URL: https://github.com/c-cube/micronats.ml
- Owner: c-cube
- License: mit
- Created: 2026-05-28T00:05:07.000Z (20 days ago)
- Default Branch: main
- Last Pushed: 2026-06-02T01:08:20.000Z (15 days ago)
- Last Synced: 2026-06-02T02:22:58.554Z (15 days ago)
- Topics: eio, nats, ocaml, pubsub
- Language: OCaml
- Homepage:
- Size: 2.9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# micronats: minimal NATS client for OCaml/Eio
[](https://github.com/c-cube/micronats.ml/actions/workflows/main.yml)
A lightweight [NATS](https://nats.io) client library for OCaml >= 5.1 built on [Eio](https://github.com/ocaml-multicore/eio).
## Example
```ocaml
open Eio.Std
let () =
Eio_main.run @@ fun env ->
let net = Eio.Stdenv.net env in
Eio.Switch.run @@ fun sw ->
let@ nats = Micronats.with_connect ~sw ~net () in
let _sub = Micronats.sub nats ~sw ~subject:["greetings"]
(fun msg -> traceln "received: %s" msg.payload)
in
Micronats.pub nats ~subject:["greetings"] "hello, world!"
```
## Install
(once released)
```sh
opam install micronats
```
## License
MIT