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 5.0.4 to 5.0.5

13

build/lib/client.d.ts

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

};
export { IConnackPacket, IDisconnectPacket, IPublishPacket, Packet };
export type OnConnectCallback = (packet: IConnackPacket) => void;

@@ -171,6 +172,6 @@ export type OnDisconnectCallback = (packet: IDisconnectPacket) => void;

publish(topic: string, message: string | Buffer): MqttClient;
publish(topic: string, message: string | Buffer, callback?: DoneCallback): MqttClient;
publish(topic: string, message: string | Buffer, opts?: IClientPublishOptions, callback?: DoneCallback): MqttClient;
publishAsync(topic: string, message: string | Buffer): Promise<void>;
publishAsync(topic: string, message: string | Buffer, opts?: IClientPublishOptions): Promise<void>;
publish(topic: string, message: string | Buffer, callback?: PacketCallback): MqttClient;
publish(topic: string, message: string | Buffer, opts?: IClientPublishOptions, callback?: PacketCallback): MqttClient;
publishAsync(topic: string, message: string | Buffer): Promise<Packet | undefined>;
publishAsync(topic: string, message: string | Buffer, opts?: IClientPublishOptions): Promise<Packet | undefined>;
subscribe(topicObject: string | string[] | ISubscriptionMap): MqttClient;

@@ -186,4 +187,4 @@ subscribe(topicObject: string | string[] | ISubscriptionMap, callback?: ClientSubscribeCallback): MqttClient;

unsubscribe(topic: string | string[], opts?: IClientSubscribeOptions, callback?: PacketCallback): MqttClient;
unsubscribeAsync(topic: string | string[]): Promise<void>;
unsubscribeAsync(topic: string | string[], opts?: IClientSubscribeOptions): Promise<void>;
unsubscribeAsync(topic: string | string[]): Promise<Packet | undefined>;
unsubscribeAsync(topic: string | string[], opts?: IClientSubscribeOptions): Promise<Packet | undefined>;
end(cb?: DoneCallback): MqttClient;

@@ -190,0 +191,0 @@ end(force?: boolean): MqttClient;

@@ -390,3 +390,3 @@ "use strict";

return new Promise((resolve, reject) => {
this.publish(topic, message, opts, (err) => {
this.publish(topic, message, opts, (err, packet) => {
if (err) {

@@ -396,3 +396,3 @@ reject(err);

else {
resolve();
resolve(packet);
}

@@ -608,3 +608,3 @@ });

return new Promise((resolve, reject) => {
this.unsubscribe(topic, opts, (err) => {
this.unsubscribe(topic, opts, (err, packet) => {
if (err) {

@@ -614,3 +614,3 @@ reject(err);

else {
resolve();
resolve(packet);
}

@@ -617,0 +617,0 @@ });

{
"name": "mqtt",
"description": "A library for the MQTT protocol",
"version": "5.0.4",
"version": "5.0.5",
"contributors": [

@@ -6,0 +6,0 @@ "Adam Rudd <adamvrr@gmail.com>",

@@ -344,4 +344,12 @@ # ![mqtt.js](https://raw.githubusercontent.com/mqttjs/MQTT.js/137ee0e3940c1f01049a30248c70f24dc6e6f829/MQTT.js.png)

Async [`connect`](#connect). Returns a `Promise` that resolves to a `mqtt.Client` instance.
Asynchronous wrapper around the [`connect`](#connect) function.
Returns a `Promise` that resolves to a `mqtt.Client` instance when the client
fires a `'connect'` or `'end'` event, or rejects with an error if the `'error'`
is fired.
Note that the `manualConnect` option will cause the promise returned by this
function to never resolve or reject as the underlying client never fires any
events.
---

@@ -348,0 +356,0 @@

@@ -358,2 +358,3 @@ /**

export { IConnackPacket, IDisconnectPacket, IPublishPacket, Packet }
export type OnConnectCallback = (packet: IConnackPacket) => void

@@ -883,3 +884,3 @@ export type OnDisconnectCallback = (packet: IDisconnectPacket) => void

message: string | Buffer,
callback?: DoneCallback,
callback?: PacketCallback,
): MqttClient

@@ -890,3 +891,3 @@ public publish(

opts?: IClientPublishOptions,
callback?: DoneCallback,
callback?: PacketCallback,
): MqttClient

@@ -897,3 +898,3 @@ public publish(

opts?: IClientPublishOptions | DoneCallback,
callback?: DoneCallback,
callback?: PacketCallback,
): MqttClient {

@@ -983,8 +984,11 @@ this.log('publish :: message `%s` to topic `%s`', message, topic)

public publishAsync(topic: string, message: string | Buffer): Promise<void>
public publishAsync(
topic: string,
message: string | Buffer,
): Promise<Packet | undefined>
public publishAsync(
topic: string,
message: string | Buffer,
opts?: IClientPublishOptions,
): Promise<void>
): Promise<Packet | undefined>
public publishAsync(

@@ -994,9 +998,9 @@ topic: string,

opts?: IClientPublishOptions,
): Promise<void> {
): Promise<Packet | undefined> {
return new Promise((resolve, reject) => {
this.publish(topic, message, opts, (err) => {
this.publish(topic, message, opts, (err, packet) => {
if (err) {
reject(err)
} else {
resolve()
resolve(packet)
}

@@ -1355,17 +1359,19 @@ })

public unsubscribeAsync(topic: string | string[]): Promise<void>
public unsubscribeAsync(
topic: string | string[],
): Promise<Packet | undefined>
public unsubscribeAsync(
topic: string | string[],
opts?: IClientSubscribeOptions,
): Promise<void>
): Promise<Packet | undefined>
public unsubscribeAsync(
topic: string | string[],
opts?: IClientSubscribeOptions,
): Promise<void> {
): Promise<Packet | undefined> {
return new Promise((resolve, reject) => {
this.unsubscribe(topic, opts, (err) => {
this.unsubscribe(topic, opts, (err, packet) => {
if (err) {
reject(err)
} else {
resolve()
resolve(packet)
}

@@ -1372,0 +1378,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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