UNPKG

rocket.chat.mqtt

Version:

It's a MQTT Server, using redis to scale horizontally.

23 lines (17 loc) 444 B
#! /usr/bin/env node var mqtt = require('mqtt') var client = mqtt.connect({ port: 1883, host: 'localhost', clean: true, encoding: 'binary', keepalive: 0 }) var counter = 0 var interval = 5000 function count () { console.log('received/s', counter / interval * 1000) counter = 0 } setInterval(count, interval) client.on('connect', function () { count() this.subscribe('test') this.on('message', function () { counter++ }) })