Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Connecting to MQTT on NodeMCU
-- Create an MQTT client with a 2m keep-alive interval.
client = mqtt.Client(wifi.sta.getmac(), 120)
-- Connect to the broker
client:connect(
"amesbielenberg.com", -- broker hostname
1883, -- default MQTT port
0, -- no security
function(client) -- on-connect callback
print ("connected.")
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment