ok. this problem solved by setting options when 'create'
but i have next one. i can see messages in debug, but mqtt module give me error again
function mqttRun(){ var server = 'my_broker'; var options = { keep_alive: 60, port: my_port, clean_session: my_port, client_id: "my_id", username: "my_user", password: "my_pass", protocol_name: "MQTT", protocol_level: 4, }; var mqtt = require("MQTT").create(server, options); // changes here mqtt.on('connected', function() { mqtt.subscribe("/test"); }); mqtt.on('publish', function (pub) { // this place throw error console.log("topic: "+pub.topic); console.log("message: "+pub.message); }); mqtt.connect(); }
Uncaught Error: Field or method "topic" does not already exist, and can't create it on undefined
@Ickis 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.
ok. this problem solved by setting options when 'create'
but i have next one. i can see messages in debug, but mqtt module give me error again
Uncaught Error: Field or method "topic" does not already exist, and can't create it on undefined