It seems to work on esp32 On esp32 I get a catch, but on esp8266 nothing happens
// mqtt_simple_V0.6_test01.js var ver = 'V0.6'; var client; function onConnect() { console.log('her er der noget'); } function onInit(){ var logon = require('LOGON'); console.log("Connecting to WiFi"); wifi = require("Wifi"); wifi.connect(logon.ssid, {password:logon.pass}, function(err){ console.log("connected? err=", err, "info=", wifi.getIP()); console.log('creating client'); try { client = require("net").connect({host: "192.168.20.21", port: 1883}, onConnect); } // end try catch(e) { console.log('err ' + e); } // end catch }); } onInit(); // remove before save()
/* on esp8266 No error. Minified 58 bytes to 49 bytes. > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 1v96.51 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 512KB:256/256, manuf 0xe0 chip 0x4014 >Connecting to WiFi =undefined connected? err= null info= { "ip": "192.168.20.30", "netmask": "255.255.255.0", "gw": "192.168.20.1", "mac": "5c:cf:7f:e7:d2:7b" } creating client > */
/* on esp32 No error. Minified 58 bytes to 49 bytes. > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 1v96.35 (c) 2018 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >Connecting to WiFi =undefined connected? err= null info= { "ip": "192.168.20.50", "netmask": "255.255.255.0", "gw": "192.168.20.1", "mac": "d8:a0:1d:40:6e:40" } creating client ERROR: Connect failed (err 113) err InternalError: Unable to create socket > */
Yes, on esp32, I get the error because I have not started the client, but nothing on esp8266
@Frida 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.
It seems to work on esp32
On esp32 I get a catch, but on esp8266 nothing happens
Yes, on esp32, I get the error because I have not started the client, but nothing on esp8266