How do we create a Node from an RxJs Observable?

Is there a way to emit a message stream in a node by subscribing to an Observable?

I'm sure you could create a node that uses RxJs Observable.

Is that what you are trying to do - create a custom node? (you posted this in the "Creating Nodes" section.


Are you talking about using an Observable in your flows?

Yes, creating a custom node.

Would that mean:

  1. Subscribing to the observable, and at every next(), a message payload is sent.
  2. When the node is closed, the observable is unsubscribed from.

Is there some asynchronous implementation needed for this case?


Depends what you are trying to achieve. What do you have in mind?

custom Nodes have the input event - you could do whatever you need based on topic
e.g. It could be that you use a msg.topic as a control (e.g. if msg.topic == "setup", if msg.topic == "next", if msg.topic == "clear")

custom Nodes have a close event - you should clean up at this point.

Regarding async, when the observable fires, you can call node.send(msg) to emit the observables next item for example.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.