All Projects → flukso → Lua Mosquitto

flukso / Lua Mosquitto

Licence: other
Lua bindings to the libmosquitto MQTT client library.

Programming Languages

c
50402 projects - #5 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to Lua Mosquitto

node-deepstackai-trigger
Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
Stars: ✭ 154 (+227.66%)
Mutual labels:  mqtt, mqtt-client
Mqtt C
A portable MQTT C client for embedded systems and PCs alike.
Stars: ✭ 342 (+627.66%)
Mutual labels:  mqtt, mqtt-client
Kmansonoff
Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt
Stars: ✭ 282 (+500%)
Mutual labels:  mqtt, mqtt-client
Paho.mqttdotnet
A .Net wrapper for eclipse/paho.mqtt.c
Stars: ✭ 33 (-29.79%)
Mutual labels:  mqtt, mqtt-client
Adafruit mqtt library
Arduino library for MQTT support
Stars: ✭ 441 (+838.3%)
Mutual labels:  mqtt, mqtt-client
ESPecial
ESP32 automation with web interface and telegram bot
Stars: ✭ 77 (+63.83%)
Mutual labels:  mqtt, mqtt-client
Wolfmqtt
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
Stars: ✭ 316 (+572.34%)
Mutual labels:  mqtt, mqtt-client
wyzesense2mqtt
Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
Stars: ✭ 55 (+17.02%)
Mutual labels:  mqtt, mqtt-client
Qmqtt
MQTT Client for Qt
Stars: ✭ 409 (+770.21%)
Mutual labels:  mqtt, mqtt-client
Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (+755.32%)
Mutual labels:  mqtt, mqtt-client
Phpmqttclient
a mqtt client library for php
Stars: ✭ 33 (-29.79%)
Mutual labels:  mqtt, mqtt-client
Hbmqtt
MQTT client/broker using Python asynchronous I/O
Stars: ✭ 667 (+1319.15%)
Mutual labels:  mqtt, mqtt-client
WeConnect-mqtt
MQTT Client that publishes data from Volkswagen WeConnect
Stars: ✭ 14 (-70.21%)
Mutual labels:  mqtt, mqtt-client
asyncio-mqtt
Idomatic asyncio wrapper around paho-mqtt
Stars: ✭ 137 (+191.49%)
Mutual labels:  mqtt, mqtt-client
ArduinoMqtt
MQTT client for Arduino
Stars: ✭ 58 (+23.4%)
Mutual labels:  mqtt, mqtt-client
Mqtt Panel
A web interface for MQTT
Stars: ✭ 315 (+570.21%)
Mutual labels:  mqtt, mqtt-client
zmosq
MQTT/Mosquitto / ZeroMQ proxy
Stars: ✭ 22 (-53.19%)
Mutual labels:  mqtt, mqtt-client
mqtt-mock
mqtt压测工具。支持subscribe、publish压测方式,支持模拟客户端连接数。
Stars: ✭ 78 (+65.96%)
Mutual labels:  mqtt, mqtt-client
Tdm
GUI application to discover and monitor devices flashed with https://github.com/arendst/Sonoff-Tasmota
Stars: ✭ 385 (+719.15%)
Mutual labels:  mqtt, mqtt-client
Mosquitto Php
A wrapper for the Eclipse Mosquitto™ MQTT client library for PHP.
Stars: ✭ 448 (+853.19%)
Mutual labels:  mqtt, mqtt-client

lua-mosquitto

Lua bindings to the libmosquitto client library.

The parameters to all functions are as per libmosquitto's api only with sensible defaults for optional values, and return values directly rather than via pointers.

Generated API documentation for the lua functions is also available (Direct link if you are within github)

Compile

You need Lua and mosquitto development packages (headers and libs) to build lua-mosquitto.

Compile with

make

You can override the pkg-config package name to set a specific Lua version. For example:

make LUAPKG=lua5.2

Example usage

Here is a very simple example that subscribes to the broker $SYS topic tree and prints out the resulting messages:

mqtt = require("mosquitto")
client = mqtt.new()

client.ON_CONNECT = function()
        print("connected")
        client:subscribe("$SYS/#")
        local mid = client:subscribe("complicated/topic", 2)
end

client.ON_MESSAGE = function(mid, topic, payload)
        print(topic, payload)
end

broker = arg[1] -- defaults to "localhost" if arg not set
client:connect(broker)
client:loop_forever()

Here is another simple example that will just publish a single message, "hello", to the topic "world" and then disconnect.

mqtt = require("mosquitto")
client = mqtt.new()

client.ON_CONNECT = function()
        client:publish("world", "hello")
        local qos = 1
        local retain = true
        local mid = client:publish("my/topic/", "my payload", qos, retain)
end

client.ON_PUBLISH = function()
	client:disconnect()
end

broker = arg[1] -- defaults to "localhost" if arg not set
client:connect(broker)
client:loop_forever()
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].