Skip to content

ccba/mqttclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mqtt client base on mqttws for the websocket connection

mqtt的websocket长链接客户端

Features

  • Equip with ES6 & Babel 6
  • Build with gulp

How to use

First, you should clone the repo and install the dependencies.

$ git clone https://github.com/ccba/mqttclient.git <foldername>
$ cd <foldername>
$ npm install

Then, build the source to the disk

$ gulp

finally, use the mqttclient like this

  • subscribe a topic(订阅一个topic)
let mqtt = new MqttClient("127.0.0.1", "8080", '');
mqtt.connect(() => {
    mqtt.subscribe("topic", (message) => {
        console.log(message);
    });
});
  • publish a message by a topic(发送消息到topic)
mqtt.publish("topic", "publish to a message");

License

MIT

About

Mqtt长连接库

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published