mqtt client - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: mqtt client (/showthread.php?tid=1132) |
mqtt client - JohnTH - 08.12.2017 Hi, anyone got a working example on how to connect to mqtt broker in local network? How should broker ip,port be set? I can`t find any examples on how to do this. The broker has been tested and from nodered i can publish to it. -John Code: mqtt = require("mosquitto") RE: mqtt client - admin - 08.12.2017 Like this, port is optional and defaults to 1883: Code: broker = '10.85.0.4' If you need to set a custom port then pass it as a second parameter to connect: Code: client:connect('10.85.0.4', 12345) |