• Hi,
    For some odd reason the code is as follows; Just playing around and bumped into the issue.
    Is anyone else seeing this issue ? I am uploading directly to the ESP8266

    var wifi = require("Wifi");
    
    var server = "192.168.1.25";
    
    var mqtt = require("MQTT").create(server);
    mqtt.on('connected', function() {
      mqtt.subscribe("pcduino");
    });
    
    mqtt.on('publish', function (pub) {
      console.log("topic: "+pub.topic);
      console.log("message: "+pub.message);
    });
    
    
    wifi.stopAP();
    wifi.disconnect(); 
    wifi.scan(function(data){
    
      for(x in data)
      {
        console.log(data[x].ssid);
      }
    
      //wifi.connect("ABC", {password:"xyz"}, function(err){
      //  console.log("connected? err=", err, "info=", wifi.getIP());
      //});
    
      wifi.connect("Zain-E5577-0462", {password:"85887536"}, function(err){
        console.log("connected? err=", err, "info=", wifi.getIP());
        mqtt.connect({
          keep_alive: 60, // keep_alive[seconds]
          port: 1883, // port number
          clean_session: 1883, // port number
          username: "xyz", 
          password: "xyz", 
          protocol_name: "MQTT", // or MQIsdp, etc..
          protocol_level: 0, // protocol_level
        });
      });
    
    });
    

    Error As follows;

    Uncaught Error: Function "write" not found!
     at line 1 col 35
    ....log("Client connected");b.write(a.mqttConnect(a.clie­nt_id))...
                                  ^
    in function "d" called from line 3 col 143
    ..."close")});a.client=b};b?d():b=requir­e("net").connect({host:...
                                  ^
    in function "connect" called from line 1 col 184
    ...me:'MQTT',protocol_level:0});
                                  ^
    in function called from system
    
About

Avatar for NodePool @NodePool started