Skip to content

Commit

Permalink
fix: types (#1341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoseph Maguire authored Oct 19, 2021
1 parent 7466819 commit 59fab36
Show file tree
Hide file tree
Showing 50 changed files with 10,712 additions and 10,714 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ coverage
test/typescript/.idea/*
test/typescript/*.js
test/typescript/*.map
package-lock.json
# VS Code stuff
**/typings/**
**/.vscode/**
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
package-lock = false
1,666 changes: 833 additions & 833 deletions README.md

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions benchmarks/bombing.js
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()
})
44 changes: 22 additions & 22 deletions benchmarks/throughputCounter.js
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++
})
})
54 changes: 27 additions & 27 deletions bin/mqtt.js
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()
}
Loading

0 comments on commit 59fab36

Please sign in to comment.