Open francescoagati opened 3 years ago
Thank you for the message.
Did I understand correctly that you
i.e. the state machine node itself should not own any state information and it is fed externally into it instead? I think of it as some sort of "stateless state-machine".
I think this is a good idea and it could be done rather easily (except maybe the sidebar-part). I would probably create a new second node type for this.
Some caveats:
Another possible implementation could be that state-machine nodes themselves have functionality for multiple sessions, i.e. for every session the internal context is kept separately. A new session could be started/reset/deleted with special input messages.
What would suit you best for your use-case?
yes, i think that the stateless state-machine resolve all my problems. i have write this issue because the old project node red state machine create a global instance state machine for every node. but if xstate is stateless resolve my problems now
I think I have a similar use case.
I need to keep a separate instance of the same state machine for every device that is added automatically into node-red via mqtt.
Is this possible with the current version?
I think I have a similar use case.
I need to keep a separate instance of the same state machine for every device that is added automatically into node-red via mqtt.
Is this possible with the current version?
@RGNagel: I think it could be possible as xstate offers invoked service functionality. Each invoked service can be a dynamically created state machine instance itself that can communicate to and from a main state-machine and manage its own context. I haven't used that functionality yet so I'm afraid I can't give you a tangible example.
However, I think debugging such a state machine in node-red is very cumbersome as the visualization on the sidebar currently only allows for visualizing the "main" state-machine.
Thank you for your feedback. I am going to take a look on it.
Hi ! Is there any news in this thread? I’m also interested in such feature.
hello, the actual implmentation can support many instances of the same state machine. my idea is of passing the state and the data for every message and in this mode i can expose the state machine via an api rest and each session user have is state and data but the same implmentation of the state machine