You are reading a single comment by @Wilberforce and its replies. Click here to read the full conversation.
  • you need to watch for wifi.on("connected") events - and in this function do your MQTT setup.

    So if the connection is dropped, or the board restarts, it will then run this code.

    There is some discussion on gitter about this - you might ask them to post their code so you can see how they have set it up...

    https://gitter.im/espruino/Espruino?at=5­8ee1f738e4b63533dbfad9e

    Something like:

    function Start() {
    console.log("starting servers");
    var http = require('http').createServer(onPageReque­st);
    http.listen(80);
    }
    
    var wifi=require("Wifi");
    
    wifi.on('connected', Start );
    
    
About

Avatar for Wilberforce @Wilberforce started