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

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

MQTT client in Typescript

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-21.68%
Maintainers
1
Weekly downloads
 
Created
Source

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.

These are the key features:

  • Multiple Transports (TLS, TCP, more to come)
  • Focus On Extensibility (using easy to extend classes)
  • Written in Typescript
  • RxJS Observables and Subjects
  • Parameterized listeners: devices/:name/color will also give you any object with the properties: {name: '...'}

Example

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 :)' });

Keywords

FAQs

Package last updated on 22 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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