example using mosquitto MQTT client library
C Makefile Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Makefile
README.md
client.c
tick

README.md

This is a small example using mosquitto's MQTT client library.

It creates a client that connects to an MQTT broker at localhost:1883 (if running), then subscribes to the topics tick, control/#{PID}, and control/all. Every time it gets a tick message via the tick topic, it publishes its pid and uptime on tock/#{PID}. If the message halt is received on control/all or control/#{PID}, the client will free its resources and halt.

Note: If you are running a Linux distribution that uses apt-based packaging (e.g. Debian or Ubuntu) you may need to install the -dev packages as well as the basic mosquitto packages to get the headers.

NOTE: THIS EXAMPLE MAY BE OUT OF DATE!

It was written four years ago and the Mosquitto C library has had API changes. This example is no longer actively maintained (but pull requests or requests to take over maintainership are welcome).