Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junker/chicken-mosquitto
Chicken Scheme bindings to the libmosquitto MQTT client library
https://github.com/junker/chicken-mosquitto
chicken-scheme mosquitto mqtt mqtt-client scheme-language
Last synced: about 9 hours ago
JSON representation
Chicken Scheme bindings to the libmosquitto MQTT client library
- Host: GitHub
- URL: https://github.com/junker/chicken-mosquitto
- Owner: Junker
- License: mit
- Created: 2023-12-28T05:13:25.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-05-09T04:11:56.000Z (6 months ago)
- Last Synced: 2024-05-10T02:45:52.210Z (6 months ago)
- Topics: chicken-scheme, mosquitto, mqtt, mqtt-client, scheme-language
- Language: Scheme
- Homepage:
- Size: 35.2 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chicken-mosquitto
Chicken Scheme Bindings to mosquitto MQTT client library
## Requirements
- [libmosquitto](https://mosquitto.org) installed
## Instalation
```bash
chicken-install mosquitto
```## Usage
Example client which sends message into `topic2` each time it gets message from `topic1`:
```scheme
(import (chicken blob)
(chicken string)
(mosquitto))(define (message message)
(display message)
(newline)
(flush-output))(define client
(make-mqtt-client #:on-connect (lambda (client err)
(when err
(abort err))
(message "Yay, we are connected!")
(mqtt-subscribe client "topic1"))))(set-mqtt-client-disconnect-callback! client
(lambda (cl unexpected?)
(when unexpected?
(message "Unexpected disconnect..."))))(set-mqtt-client-message-callback! client
(lambda (cl msg)
(message (string-append
"Topic: " (mqtt-message-topic msg) " "
"Payload:" (blob->string (mqtt-message-payload msg))))
(mqtt-publish client "topic2" "message received, thanks!" )))(mqtt-connect client "localhost"
#:username "mqtt-admin"
#:password "mypass")(mqtt-loop-forever client)
```## Documentation
[Full Documentation](http://wiki.call-cc.org/eggref/5/mosquitto)