I would like to push messages from the runtime to the editor and use notify (or other method) to display them.
I have stumbled across [CommsConnection(Global - Documentation) which takes about WebSocket between the runtime to the editor.
Sadly I wasn't able to figure out how to integrate with this module on the run time end.
I'm using NodeRed 2.2.2 as an embedding application.
Really, there is, and should be, a deliberate gap between the runtime and the Editor. It is the intent of the project to further separate them in the future.
I've not myself seen CommsConnection mentioned anywhere else so I can't comment about it specifically. However, the recommended approach of communication between a custom node's runtime and the Editor is to set up an API in the runtime and access that from the Editor using jQuery's AJAX methods or Fetch.
Obviously though, this is a pull rather than a push.
It might be helpful here to have a comment from @knolleary as to whether that is an acceptable use of the API as I don't think it is documented and we are generally advised not to use undocumented features of the API?
Had I known about this, it would greatly simplify comms between the uibuilder back-end and Editor front-end.
He Colin,
He is just sharing his POC which he used to test to push some dummy data across the websocket channel. I don't think this simple experiment will grow to become to become an alternative for Tik-Tok
I will echo this point @dannyhuly - if you choose to go down this route, make sure you give your events names unique to your node. Do not use single word names.
@TotallyInformation you have a good point and I'm still on the fence about using the Cooms or just user WebSocket of my own. But I do like the Cooms solution because Its uses native RedNode infrastructure which simplify the code.
@knolleary thanks for the heads up. In my real code the message name is more complex and follows the NodeRed event name convention <COMPONENT_NAME>:<ACTION>.