Skip to content

Instantly share code, notes, and snippets.

@kevsmith
Last active August 29, 2015 14:06
Show Gist options
  • Save kevsmith/bf4e889bb3d1b49125e3 to your computer and use it in GitHub Desktop.
Save kevsmith/bf4e889bb3d1b49125e3 to your computer and use it in GitHub Desktop.
test.lua
local function test()
mqtt = require("mqtt/mqtt")
conn = mqtt:new_connection()
conn.user = "guest"
conn.password = "guest"
if conn:connect("localhost", 1883, true) then
conn:loop(100)
conn:publish("testing", "this is a test", mqtt.qos1, false)
conn:loop(100)
conn:disconnect()
conn:loop_once()
end
end
local r, v = pcall(test)
print(r,v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment