wtc-sub-middleware
v1.3.2
Published
We The Curious actions subscription middleware
Downloads
4
Readme
We The Curious actions middleware
This is a piece of middleware used in react redux app to pass actions to a broker via MQTT.
How to use:
import { createMQTTMiddleware } from 'wtc-sub-middleware'
createMQTTMiddleware('http://localhost:1884', '--origin--')
Origin is an optional parameter that gets added to final published output
Accepts a url parameter, publishes current action, and then passes that same action back into the store.
By default subscribed to all actions, can be changed to subscribe to specific list of action like so:
client.subscribe(['BUTTON_PRESS', 'TOGGLE_SWITCH'])
Some basic error catchers. Looks for a broker connection every 10s.