简体   繁体   中英

MQTT Client for node.js TypeError

I try to understand and implement the MQTT-Client for node.js, which can be found at: http://jahbromo.blogspot.de/2011/12/client-mqttt-javascript.html

I keep getting:
var client = new mqtt.MQTTClient(1883,'127.0.0.1','mirror');
^
TypeError: undefined is not a function

I'm relatively new to node.js I don't understand why node.js is giving this error

So first of all it is worth knowing that that blog stole the content from the original author here: http://ceit.uq.edu.au/content/simple-mqtt-cient-nodejs

Yilun's code is on Github but hasn't been updated in a couple of years.

https://github.com/yilun/node_mqtt_client

I would recommend taking a look at the mqttjs node module instead.

https://github.com/adamvr/MQTT.js

That has some good examples which enable you to create a client quite easily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM