New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

expressify-mqtt

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expressify-mqtt

Transport strategy for Expressify REST mechanisms over MQTT.

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

expressify-mqtt

An Expressify strategy enabling RESTful application over an MQTT(S) transport.

CodeFactor

Current version: 1.0.0

Lead Maintainer: Halim Qarroum

Table of contents

Install

npm install --save expressify-mqtt

Features

  • Natively supports the MQTT.js and the AWS IoT SDK librairies.
  • Usage of an MQTT query-response pattern to optimize message exchanges and costs.
  • Supports observation of resources using dedicated MQTT topics.
  • Supports Node.js and the Browser (MQTT-over-Websockets).
  • Automatically detects disconnected observers to stop emitting resource updates.

Usage

In order to use expressify-mqtt, you need to create an instance of the strategy using a backend such as MQTT.js or the AWS IoT SDK. The strategy requires that the MQTT backend follows the same interface as MQTT.js.

Creating a client

When initializing the expressify-mqtt strategy, you need to pass it a supported MQTT back-end, as well as a topic mountpoint indicating the base topic which the strategy will use to create its topic architecture.

// Injecting the `mqtt.js` library.
const mqtt = require('mqtt');

// Creating the client instance.
const client = new Expressify.Client({
  strategy: new MqttStrategy({ mqtt, topic: 'foo' })
});

Note that given the used MQTT service, there might be limitations on the number of forward slashes you can use.

Creating a server

The below example shows you how to create an instance of an Expressify server using the mqtt strategy.

// Injecting the `mqtt.js` library.
const mqtt = require('mqtt');

// Creating the server instance.
const server = new Expressify.Server({
  strategy: new MqttStrategy({ mqtt, topic: 'foo' })
});

// Listening for incoming requests.
server.listen().then(() => {
  console.log(`[+] The server is listening on mount point '${server.strategy.opts.topic}' !`);
});

Examples

Different functional examples involving the expressify-mqtt strategy are available in the examples directory.

See also

Keywords

FAQs

Package last updated on 01 Jun 2018

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