dolphin-mq
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

@baifendian/dolp

该模块属于 DOLPHIN 协议的顶层API调用,基于 mqtt 开发,基本一致。

Installation

npm install @baifendian/dolp --save

Example

For the sake of simplicity, let's put the subscriber and the publisher in the same file:

var mqtt = require('@baifendian/dolp')
var client  = mqtt.connect('mqtt://test.mosquitto.org')

client.on('connect', function () {
  client.subscribe('presence', function (err) {
    if (!err) {
      client.publish('presence', 'Hello mqtt')
    }
  })
})

client.on('message', function (topic, message) {
  // message is Buffer
  console.log(message.toString())
  client.end()
})

Package Sidebar

Install

npm i dolphin-mq

Weekly Downloads

2

Version

1.0.10

License

MIT

Unpacked Size

216 kB

Total Files

63

Last publish

Collaborators

  • xuzehui