简体   繁体   English

适用于node.js TypeError的MQTT客户端

[英]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 我尝试了解并实现用于node.js的MQTT客户端,可以在以下位置找到它: http : //jahbromo.blogspot.de/2011/12/client-mqttt-javascript.html

I keep getting: 我不断得到:
var client = new mqtt.MQTTClient(1883,'127.0.0.1','mirror'); var client = new mqtt.MQTTClient(1883,'127.0.0.1','mirror');
^ ^
TypeError: undefined is not a function TypeError:未定义不是函数

I'm relatively new to node.js I don't understand why node.js is giving this error 我对node.js相对较新,我不明白为什么node.js会出现此错误

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 因此,首先值得一提的是,该博客从此处窃取了原始作者的内容: 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. Yilun的代码在Github上,但是几年没有更新。

https://github.com/yilun/node_mqtt_client https://github.com/yilun/node_mqtt_client

I would recommend taking a look at the mqttjs node module instead. 我建议改为查看mqttjs节点模块。

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

That has some good examples which enable you to create a client quite easily. 上面有一些很好的示例,使您可以轻松地创建客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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