Examples that publish/subscribe MQTT?

So I had some thought on my drive in (it's not a long drive, so I haven't thought this through completely!).

It is clear that there is an attempt to allow custom nodes to share MQTT connections within Node Red; I think this is great. But for reasons above it is not possible for custom nodes to know when the connection changes.

I think this could be addressed by doing just two things:

  1. Promoting connection related events to all registered nodes
  2. When a node is registered, fire the current connection state to the newly registered node.

Thoughts?