unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [ANN] guile-mqtt-0.1.0 released
@ 2024-11-09 15:49 Mikael Djurfeldt
  2024-11-09 21:30 ` Mikael Djurfeldt
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Djurfeldt @ 2024-11-09 15:49 UTC (permalink / raw)
  To: guile-user

Guile MQTT provides bindings for the libmosquitto MQTT client
library. The bindings are written in GOOPS
(https://www.gnu.org/software/guile/manual/html_node/GOOPS.html)
and rely on lower-level bindings created by NYACC directly and
automatically from mosquitto.h.

The bindings align with GOOPS style, which means short method
names. (The specialization is done through the arguments.)

The user can extend the client class by inheritance.

Example:

This example, as well as the Guile libmosquitto bindings themselves,
are inspired by the Chicken Scheme mosquitto bindings
(http://wiki.call-cc.org/eggref/5/mosquitto) by Dmitrii Kosenkov.

(use-modules (mosquitto client))

(let ((client (make-client #:on-connect
                          (lambda (client err)
                            (if (not (eq? err MOSQ_ERR_SUCCESS))
                                (abort err)
                                (display "Yay, we are connected!"))))))
  (set! (disconnect-callback client)
        (lambda (client err)
          (if (not (eq? err MOSQ_ERR_SUCCESS))
            (display "Unexpected disconnect..."))))

  (set! (message-callback client)
        (lambda (cl msg)
          (display (string->append "Topic: " (topic msg)
                                   "Payload:" payload msg))
          (publish client "topic2" "message received, thanks!")))
  (connect client "localhost" #:username "mqtt-admin" #:password "mypass")
  (subscribe client "topic1")
  (loop-forever client))

See further examples under the directory examples (
https://github.com/mdjurfeldt/guile-mqqt/tree/main/examples).
Guile MQTT maturity is beta level.

 Guile MQTT is free software; the full source distribution is available
through

* a tarball:

https://github.com/mdjurfeldt/guile-mqqt/releases/download/v0.1.0/guile-mqtt-0.1.0.tar.gz

* the git repository:
     https://github.com/mdjurfeldt/guile-mqqt


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-09 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-09 15:49 [ANN] guile-mqtt-0.1.0 released Mikael Djurfeldt
2024-11-09 21:30 ` Mikael Djurfeldt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).