]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - prebuilt/iot-gateway/node_modules/aws-iot-device-sdk/node_modules/mqtt/benchmarks/bombing.js
Updated to use the latest TI 15.4-Stack v2.1.0 from the SimpleLink CC13x0 SDK v1.30.
[apps/tidep0084.git] / prebuilt / iot-gateway / node_modules / aws-iot-device-sdk / node_modules / mqtt / benchmarks / bombing.js
1 #! /usr/bin/env node
3 var mqtt = require('../');
4 var client = mqtt.connect({ port: 1883, host: "localhost", clean: true, keepalive: 0 });
6 var sent = 0;
7 var interval = 5000;
9 function count() {
10   console.log("sent/s", sent / interval * 1000);
11   sent = 0;
12 }
14 setInterval(count, interval)
16 function immediatePublish() {
17   setImmediate(publish)
18 }
20 function publish() {
21   sent++;
22   client.publish("test", "payload", immediatePublish);
23 }
25 client.on("connect", publish);
27 client.on("error", function() {
28   console.log("reconnect!");
29   client.stream.end();
30 });