mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Created Design: Dynamic MQTT node (markdown)
parent
db02c2cb56
commit
ff8f122303
29
Design:-Dynamic-MQTT-node.md
Normal file
29
Design:-Dynamic-MQTT-node.md
Normal file
@ -0,0 +1,29 @@
|
||||
There is a requirement for the MQTT nodes to allow for more dynamic configuration. There are two uses:
|
||||
|
||||
- determine a subscription topic at runtime
|
||||
- modify broker connection details at runtime
|
||||
|
||||
This design note proposes a new MQTT node that can be used to satisfy these requirements.
|
||||
|
||||
---
|
||||
|
||||
Here's the basic outline:
|
||||
|
||||
- A new MQTT node is proposed called `mqtt-control` (name, as ever, subject to change).
|
||||
- The node has an input and an output so sits in the middle of a flow
|
||||
- The node is configured with an `mqtt-broker` node - this broker node provides the connection used by the control node.
|
||||
- The node can be passed messages with a well-defined property (eg `msg.mqttControl`) that causes it to take an action.
|
||||
- The actions the node can take are:
|
||||
- Connect to its broker (with any of the `mqtt-broker` node's properties overridden by properties in the message)
|
||||
- Disconnect from the broker
|
||||
- Subscribe to a topic
|
||||
- Unsubscribe from a topic
|
||||
- Publish a message to a topic
|
||||
- The node will send any message it receives due to its subscriptions.
|
||||
- It will also pass through messages it receives when the action is complete. **TODO**: identify how to distinguish these from subscription messages
|
||||
|
||||
|
||||
Some observations from this design:
|
||||
|
||||
- the control node is controlling the `mqtt-broker` node. Other regular nodes can also use that `mqtt-broker` node so will also be effected by changes.
|
||||
- the `mqtt-broker` config node will have a new option to not auto-connect. This would be used where the decision to connect is left to the application's use of the control node.
|
Loading…
Reference in New Issue
Block a user