I tweaked Gordon's example code snippet for flexibility:
wifi.enableMDNS = function(hostname, serviceType, port, callback) { let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n"; this.at.cmd(mdns, 500, function(d) { callback(d); }); };
Now you can specify the service type and port, like this:
wifi.enableMDNS("esp-livingroom", "iot", 80, function(result) { console.log("result is " + result); });
@indianajones started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I tweaked Gordon's example code snippet for flexibility:
Now you can specify the service type and port, like this: