Go to file
Luca 8e34d4d144 feat: add installation and usage instructions 2024-09-05 18:12:00 +02:00
.editorconfig style: add and apply editorconfig 2024-09-05 14:52:59 +02:00
README.md feat: add installation and usage instructions 2024-09-05 18:12:00 +02:00
mqtt.lua fix: typos and wrong numbers 2024-09-05 17:52:07 +02:00

README.md

MineQTT

Installation

local net = require("internet"); local io = require("io"); f = io.open("/lib/mqtt.lua", "w"); for line in net.request("https://git.luj0ga.de/luca/mineqtt/raw/branch/main/mqtt.lua") do f:write(line) end; f:flush():close()

Usage

local mqtt = require("mqtt")

local client, err = mqtt.open("mqtt.example.org", 1883)
if err ~= nil then
    error(err)
end

local err = client:connect()
if err ~= nil then
    error(err)
end

local err = client:handle()
if err ~= nil then
    error(err)
end

print(client.is_connected)

local err = client:disconnect()
if err ~= nil then
    error(err)
end