• So you're saying that if you just run require("MQTT").create on its own, without the AP, it works?

    Can you try doing something like:

    apServer.close()
    setTimeout(function() {
      var client = require("MQTT").create(server, options /*optional*/);
      client.connect();
    }, 2000);
    

    And see if that works ok?

    The calls to the ESP8266 will be asynchronous, so I guess it's possible that the driver isn't correctly delaying the creation of the new MQTT connection, and so is trying to re-use the apServer socket that hasn't yet closed?

About

Avatar for Gordon @Gordon started