-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yoseph Maguire
authored
Oct 19, 2021
1 parent
7466819
commit 59fab36
Showing
50 changed files
with
10,712 additions
and
10,714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
package-lock = false | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#! /usr/bin/env node | ||
|
||
var mqtt = require('../') | ||
var client = mqtt.connect({ port: 1883, host: 'localhost', clean: true, keepalive: 0 }) | ||
|
||
var sent = 0 | ||
var interval = 5000 | ||
|
||
function count () { | ||
console.log('sent/s', sent / interval * 1000) | ||
sent = 0 | ||
} | ||
|
||
setInterval(count, interval) | ||
|
||
function publish () { | ||
sent++ | ||
client.publish('test', 'payload', publish) | ||
} | ||
|
||
client.on('connect', publish) | ||
|
||
client.on('error', function () { | ||
console.log('reconnect!') | ||
client.stream.end() | ||
}) | ||
#! /usr/bin/env node | ||
|
||
var mqtt = require('../') | ||
var client = mqtt.connect({ port: 1883, host: 'localhost', clean: true, keepalive: 0 }) | ||
|
||
var sent = 0 | ||
var interval = 5000 | ||
|
||
function count () { | ||
console.log('sent/s', sent / interval * 1000) | ||
sent = 0 | ||
} | ||
|
||
setInterval(count, interval) | ||
|
||
function publish () { | ||
sent++ | ||
client.publish('test', 'payload', publish) | ||
} | ||
|
||
client.on('connect', publish) | ||
|
||
client.on('error', function () { | ||
console.log('reconnect!') | ||
client.stream.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#! /usr/bin/env node | ||
|
||
var mqtt = require('../') | ||
|
||
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++ | ||
}) | ||
}) | ||
#! /usr/bin/env node | ||
|
||
var mqtt = require('../') | ||
|
||
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++ | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
/* | ||
* Copyright (c) 2015-2015 MQTT.js contributors. | ||
* Copyright (c) 2011-2014 Adam Rudd. | ||
* | ||
* See LICENSE for more information | ||
*/ | ||
var path = require('path') | ||
var commist = require('commist')() | ||
var helpMe = require('help-me')({ | ||
dir: path.join(path.dirname(require.main.filename), '/../doc'), | ||
ext: '.txt' | ||
}) | ||
|
||
commist.register('publish', require('./pub')) | ||
commist.register('subscribe', require('./sub')) | ||
commist.register('version', function () { | ||
console.log('MQTT.js version:', require('./../package.json').version) | ||
}) | ||
commist.register('help', helpMe.toStdout) | ||
|
||
if (commist.parse(process.argv.slice(2)) !== null) { | ||
console.log('No such command:', process.argv[2], '\n') | ||
helpMe.toStdout() | ||
} | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
/* | ||
* Copyright (c) 2015-2015 MQTT.js contributors. | ||
* Copyright (c) 2011-2014 Adam Rudd. | ||
* | ||
* See LICENSE for more information | ||
*/ | ||
var path = require('path') | ||
var commist = require('commist')() | ||
var helpMe = require('help-me')({ | ||
dir: path.join(path.dirname(require.main.filename), '/../doc'), | ||
ext: '.txt' | ||
}) | ||
|
||
commist.register('publish', require('./pub')) | ||
commist.register('subscribe', require('./sub')) | ||
commist.register('version', function () { | ||
console.log('MQTT.js version:', require('./../package.json').version) | ||
}) | ||
commist.register('help', helpMe.toStdout) | ||
|
||
if (commist.parse(process.argv.slice(2)) !== null) { | ||
console.log('No such command:', process.argv[2], '\n') | ||
helpMe.toStdout() | ||
} |
Oops, something went wrong.