You are reading a single comment by @Ickis and its replies. Click here to read the full conversation.
  • Thank you, Gordon.
    do you mean put it in order like this?

    function mqttRun(){
      var server = 'my_broker';
      var options = {
              keep_alive: 60,
              port: my_port,
              clean_session: my_port,
              username: "my_user",
              password: "my_pass",
              protocol_name: "MQTT",
              protocol_level: 4,
      };
      var mqtt = require("MQTT").create(server);
        mqtt.on('connected', function() {
        mqtt.subscribe("test");
      });
    
      
      mqtt.connect(options);
    }
    

    I tried now - same error

    >mqttRun()
    Client connected
    Uncaught Error: Function "write" not found!
    
    

    What I'm doing wrong?
    UPD. I saw this subject - http://forum.espruino.com/conversations/­293870
    example in post #5 and mine shoud do the same, but they don't

About

Avatar for Ickis @Ickis started