Socket
Socket
Sign inDemoInstall

mqtts

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqtts - npm Package Compare versions

Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2

2

dist/mqtt.client.js

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

if (!this.continueFlows(packet) && forceCheckFlows) {
this.emitWarning(new errors_1.UnexpectedPacketError(packet.constructor.name));
this.emitWarning(new errors_1.UnexpectedPacketError(mqtt_constants_1.packetTypeToString(packet.type)));
}

@@ -246,0 +246,0 @@ }

@@ -9,5 +9,8 @@ import { MqttMessage } from './mqtt.message';

export declare type RemoveHandlerFn = () => void;
export declare type HandlerFn<T = MqttMessage> = (message: T) => void;
export declare type HandlerFn<T = MessageWithParams> = (message: T) => void;
export declare type ValidatorFn<Params extends Record<string, string>> = (message: MqttMessage, params: Params) => boolean;
export declare type TransformerFn<TOut, Params extends Record<string, string>> = (message: IncomingListenMessage<Params>) => TOut | Promise<TOut>;
export declare type MessageWithParams<T extends Record<string, string> = Record<string, string>> = MqttMessage & {
params: T;
};
export interface HandlerInfo<T, Params extends Record<string, string>> {

@@ -14,0 +17,0 @@ topicFilter: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MqttTransformer = void 0;
const mqtt_constants_1 = require("./mqtt.constants");
const packet_stream_1 = require("./packet-stream");

@@ -35,3 +36,3 @@ const errors_1 = require("./errors");

if (!packetFn) {
callback(new errors_1.UnexpectedPacketError(`No packet found for ${type}; @${stream.position}/${stream.length}`));
callback(new errors_1.UnexpectedPacketError(`No packet found for ${type}; @${stream.position - 1} len: ${stream.length}`));
return;

@@ -60,7 +61,3 @@ }

else {
callback(new errors_1.MalformedPacketError(`Error in parser (type: ${type}):
${e.stack};
exiting;
resetting;
stream: ${stream.data.toString('base64')}`));
callback(new errors_1.MalformedPacketError(`Error in parser (type: ${mqtt_constants_1.packetTypeToString(type)}): ${e.message || e} - stream: ${stream.data.toString('base64')}`));
return;

@@ -67,0 +64,0 @@ }

{
"name": "mqtts",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"description": "MQTT client in Typescript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# MQTTS (MQTT Typescript)
MQTTS is a MQTT library. It currently supports _MQTT 3.1.1_ but will
add support for MQTT 5 in the future.
MQTTS is a MQTT library. It currently supports _MQTT 3.1.1_ but may
support MQTT 5 in the future.

@@ -9,28 +9,7 @@ These are the key features:

- Multiple Transports (**TLS**, **TCP**, more to come)
- Focus On Extensibility (using easy to extend `classes`)
- Focus On Extensibility
- Written in Typescript
- **RxJS** Observables and Subjects
- Parameterized listeners: `devices/:name/color` will also give you any object with the properties:
`{name: '...'}`
# Example
```typescript
import { MqttClient, TcpTransport } from 'mqtts';
const client = new MqttClient({
// connect to the hivemq testserver
transport: new TcpTransport({ url: 'mqtt://broker.hivemq.com:1883' }),
});
// connect
await client.connect();
// subscribe and listen to the topic
(
await client.listenSubscribe({
topic: 'mqtts/test/:command'
})
).subscribe(({ payload, params }) => {
console.log(payload.toString('utf8'), params);
});
// publish to the topic
await client.publish({ topic: 'mqtts/test/publish', payload: 'hi :)' });
```
**Check out the [example](examples/example.ts).**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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