Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Ames
Created July 19, 2015 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ames/ad620fbceaca014793e6 to your computer and use it in GitHub Desktop.
Save Ames/ad620fbceaca014793e6 to your computer and use it in GitHub Desktop.
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