egg-htmqtt
v1.6.0
Published
mqtt-client for egg. 使用mqtt包封装的egg客户端插件
Downloads
3
Maintainers
Readme
egg-mqtt-plugin
更详细的使用请阅读中文文档
Install
$ npm i egg-mqtt-plugin --save
Usage
// {app_root}/config/plugin.js
exports.mqtt = {
enable: true,
package: 'egg-mqtt-plugin',
};
Configuration
// {app_root}/config/config.default.js
exports.mqtt = {
host: 'mqtt://xxx.xxx.x.x',
port: 1883,
username: 'username',
password: 'password',
clientId: 'client_id',
options: {
keeplive: 60,
protocolId: 'MQTT',
protocol: 'MQTT',
protocolVersion: 4,
clean: true,
rejectUnauthorized: false,
reconnectPeriod: 1000,
connectTimeout: 30 * 1000,
},
topics: {
'topic-topic-topic': { qos: 0 },
},
};
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.