Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This seemed like a simple question but I couldn't find the answer anywhere, so apologies if it's already posted somewhere.
Anyway, I'm trying to reset a history state back to its initial value after some condition is reached. Is there any action/method I could call to do this?
What I'm trying to do
Basically I've got this mildly complicated reconnecting websocket. A caller may "close" the connection, but internally we have to drain a buffer of messages, and send a couple cleanup messages to the server before actually closing the connection. This process itself can be disrupted (read: connection lost), so that was the impetus for using a history state to return to the
connected.closing
state. However, when the machine actually does reach theclosed
state I want to reset this history state, or else subsequent attempts to "re-open" will transition to thisconnected.readyToClose
state, which is really not what we want.Hopefully there's a simple way to just reset this history state back to it's initial target. Otherwise I COULD take the following approaches:
isClosing: true
in the context, and use a guard to transition instead of the history node. I'll probably end up doing this, but it felt gross (the connected child states are fairly locked down at this point, but if that changes, there's a chance this logic will have to change as well) .closed
as a "final" state and stop the actor, then create a new actor. This could work, but then I'd have to make sure everything gets re-instantiated and re-bound as necessary. Seems like overkill.Beta Was this translation helpful? Give feedback.
All reactions