Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mqtt

Package Overview
Dependencies
Maintainers
7
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqtt - npm Package Compare versions

Comparing version 4.3.7 to 5.0.0-beta.0

lib/is-browser.js

15

lib/client.js

@@ -39,6 +39,7 @@ 'use strict'

'ECONNRESET',
'ENOTFOUND'
'ENOTFOUND',
'ETIMEDOUT'
]
// Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND.
// Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND, ETIMEDOUT.

@@ -273,3 +274,3 @@ const errors = {

debug('MqttClient :: options.rejectUnauthorized', options.rejectUnauthorized)
debug('MqttClient :: options.topicAliasMaximum', options.topicAliasMaximum)
debug('MqttClient :: options.properties.topicAliasMaximum', options.properties ? options.properties.topicAliasMaximum : undefined)

@@ -324,7 +325,7 @@ this.options.clientId = (typeof options.clientId === 'string') ? options.clientId : defaultId()

if (options.topicAliasMaximum > 0) {
if (options.topicAliasMaximum > 0xffff) {
debug('MqttClient :: options.topicAliasMaximum is out of range')
if (options.properties && options.properties.topicAliasMaximum > 0) {
if (options.properties.topicAliasMaximum > 0xffff) {
debug('MqttClient :: options.properties.topicAliasMaximum is out of range')
} else {
this.topicAliasRecv = new TopicAliasRecv(options.topicAliasMaximum)
this.topicAliasRecv = new TopicAliasRecv(options.properties.topicAliasMaximum)
}

@@ -331,0 +332,0 @@ }

@@ -5,2 +5,5 @@ 'use strict'

const Store = require('../store')
const DefaultMessageIdProvider = require('../default-message-id-provider')
const UniqueMessageIdProvider = require('../unique-message-id-provider')
const IS_BROWSER = require('../is-browser').IS_BROWSER
const url = require('url')

@@ -12,4 +15,3 @@ const xtend = require('xtend')

// eslint-disable-next-line camelcase
if ((typeof process !== 'undefined' && process.title !== 'browser') || typeof __webpack_require__ !== 'function') {
if (!IS_BROWSER) {
protocols.mqtt = require('./tcp')

@@ -168,1 +170,3 @@ protocols.tcp = require('./tcp')

module.exports.Store = Store
module.exports.DefaultMessageIdProvider = DefaultMessageIdProvider
module.exports.UniqueMessageIdProvider = UniqueMessageIdProvider

@@ -8,2 +8,3 @@ 'use strict'

const Transform = require('readable-stream').Transform
const IS_BROWSER = require('../is-browser').IS_BROWSER

@@ -18,4 +19,3 @@ const WSS_OPTIONS = [

]
// eslint-disable-next-line camelcase
const IS_BROWSER = (typeof process !== 'undefined' && process.title === 'browser') || typeof __webpack_require__ === 'function'
function buildUrl (opts, client) {

@@ -22,0 +22,0 @@ let url = opts.protocol + '://' + opts.hostname + ':' + opts.port + opts.path

{
"name": "mqtt",
"description": "A library for the MQTT protocol",
"version": "4.3.7",
"version": "5.0.0-beta.0",
"contributors": [

@@ -9,3 +9,4 @@ "Adam Rudd <adamvrr@gmail.com>",

"Siarhei Buntsevich <scarry0506@gmail.com> (https://github.com/scarry1992)",
"Yoseph Maguire <yomaguir@microsoft.com> (https://github.com/YoDaMa)"
"Yoseph Maguire <yomaguir@microsoft.com> (https://github.com/YoDaMa)",
"Daniel Lando <daniel.sorridi@gmail.com> (https://github.com/robertsLando)"
],

@@ -29,3 +30,3 @@ "keywords": [

"typescript-compile-execute": "node test/typescript/broker-connect-subscribe-and-publish.js",
"browser-build": "rimraf dist/ && mkdirp dist/ && browserify mqtt.js --standalone mqtt > dist/mqtt.js && uglifyjs dist/mqtt.js --compress --mangle --output dist/mqtt.min.js",
"browser-build": "rimraf dist/ && mkdirp dist/ && browserify mqtt.js --standalone mqtt > dist/mqtt.js && terser dist/mqtt.js --compress --mangle --output dist/mqtt.min.js",
"prepare": "npm run browser-build",

@@ -37,4 +38,33 @@ "unit-test:node": "node_modules/.bin/nyc --reporter=lcov --reporter=text ./node_modules/mocha/bin/_mocha --exit",

"test:typescript": "npm run typescript-compile-test && npm run typescript-compile-execute",
"test": "npm run test:node && npm run test:typescript"
"test": "npm run test:node && npm run test:typescript",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
"changelog-init": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it"
},
"release-it": {
"github": {
"release": true
},
"git": {
"tagName": "v${version}",
"commitMessage": "chore(release): ${version}"
},
"hooks": {
"before:init": [
"npm run test"
],
"after:bump": [
"npm run changelog"
]
},
"npm": {
"publish": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
}
},
"pre-commit": [

@@ -58,3 +88,3 @@ "pretest"

"engines": {
"node": ">=10.0.0"
"node": ">=16.0.0"
},

@@ -75,7 +105,7 @@ "browser": {

"lru-cache": "^6.0.0",
"minimist": "^1.2.5",
"mqtt-packet": "^6.8.0",
"number-allocator": "^1.0.9",
"minimist": "^1.2.6",
"mqtt-packet": "^8.1.2",
"number-allocator": "^1.0.14",
"pump": "^3.0.0",
"readable-stream": "^3.6.0",
"readable-stream": "^4.1.0",
"reinterval": "^1.1.0",

@@ -88,3 +118,4 @@ "rfdc": "^1.3.0",

"devDependencies": {
"@types/node": "^10.0.0",
"@release-it/conventional-changelog": "^5.1.1",
"@types/node": "^12.20.55",
"@types/tape": "^4.13.2",

@@ -94,6 +125,7 @@ "@types/ws": "^7.4.7",

"airtap": "^4.0.4",
"browserify": "^16.5.0",
"browserify": "^17.0.0",
"chai": "^4.2.0",
"chokidar": "^3.5.3",
"codecov": "^3.0.4",
"conventional-changelog-cli": "^3.0.0",
"end-of-stream": "^1.4.1",

@@ -106,2 +138,3 @@ "global": "^4.3.2",

"pre-commit": "^1.2.2",
"release-it": "^15.11.0",
"rimraf": "^3.0.2",

@@ -113,4 +146,4 @@ "should": "^13.2.1",

"tape": "^5.5.2",
"typescript": "^4.5.5",
"uglify-es": "^3.3.9"
"terser": "^5.14.2",
"typescript": "^4.5.5"
},

@@ -117,0 +150,0 @@ "standard": {

@@ -9,6 +9,2 @@ ![mqtt.js](https://raw.githubusercontent.com/mqttjs/MQTT.js/137ee0e3940c1f01049a30248c70f24dc6e6f829/MQTT.js.png)

| :boom: MQTT.js vNext |
|:---------------------------|
| Want to contribute to the next generation of **MQTT.js**? Join the discussion [here](https://github.com/mqttjs/MQTT.js/discussions/1324). |
## Table of Contents

@@ -35,4 +31,4 @@ * [__MQTT.js vNext__](#vnext)

<a name="vnext"></a>
## Discussion on the next major version of MQTT.js
There are discussions happening on the future of MQTT.js and the next major version (vNext). We invite the community to provide their thoughts and feedback in [this GitHub discussion](https://github.com/mqttjs/MQTT.js/discussions/1324)
## Next major version of MQTT.js
There is work being done on the next generation of MQTT.js (vNext). We invite the community to provide their contributions [this repository](https://github.com/mqttjs/mqttjs-v5)

@@ -212,3 +208,3 @@ <a name="notes"></a>

return `${this.get_signed_cloud_url(url)`;
return `${this.get_signed_cloud_url(url)}`;
}

@@ -634,2 +630,4 @@

* [mqtt-jsonl-store](https://github.com/robertsLando/mqtt-jsonl-store) which uses
[jsonl-db](https://github.com/AlCalzone/jsonl-db) to store inflight data, it works only on Node.
* [mqtt-level-store](http://npm.im/mqtt-level-store) which uses

@@ -796,9 +794,12 @@ [Level-browserify](http://npm.im/level-browserify) to store the inflight

### Pre-requisites
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets a few of these requirements:
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets these requirements:
* TypeScript >= 2.1
* Set tsconfig.json: `{"compilerOptions" : {"moduleResolution" : "node"}, ...}`
* Includes the TypeScript definitions for node. You can use npm to install this by typing the following into a terminal window:
`npm install --save-dev @types/node`
### Typescript example
* Includes the TypeScript definitions for Node and [ws](https://www.npmjs.com/package/ws). These types are used as
parameters to some of the MQTT client's APIs and if you don't install them they get treated as `any`, which means you lose type
safety.
Use npm to install them by typing the following into a terminal window:
`npm install --save-dev @types/node @types/ws`
### TypeScript example
```

@@ -805,0 +806,0 @@ import * as mqtt from "mqtt"

@@ -53,3 +53,3 @@ import { MqttClient } from './client'

*/
password?: string
password?: Buffer | string
/**

@@ -64,2 +64,6 @@ * a Store for the incoming packets

queueQoSZero?: boolean
autoUseTopicAlias?: boolean
autoAssignTopicAlias?: boolean
reschedulePings?: boolean

@@ -66,0 +70,0 @@ servers?: Array<{

@@ -11,3 +11,3 @@ /// <reference types="node" />

import { Store } from './store'
import { IAuthPacket, IConnectPacket, IPublishPacket, IDisconnectPacket, IConnackPacket, Packet, QoS } from 'mqtt-packet'
import { IAuthPacket, IPublishPacket, IDisconnectPacket, IConnackPacket, Packet, QoS } from 'mqtt-packet'

@@ -72,3 +72,3 @@ export interface ISubscriptionGrant {

export declare type OnDisconnectCallback = (packet: IDisconnectPacket) => void
export declare type ClientSubscribeCallback = (err: Error, granted: ISubscriptionGrant[]) => void
export declare type ClientSubscribeCallback = (err: Error | null, granted: ISubscriptionGrant[]) => void
export declare type OnMessageCallback = (topic: string, payload: Buffer, packet: IPublishPacket) => void

@@ -75,0 +75,0 @@ export declare type OnPacketCallback = (packet: Packet) => void

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc