Skip to content
State machine (FSM) templates

Connection Lifecycle (State Machine)

Connect, drop and reconnect behaviour.

Template previewState machine (FSM)
Connection lifecycle4 states · 6 transitions · 6 eventsconnectestablishedfaildroprestoredgive_upDisconnectedConnectingConnectedReconnectingAll 4 states are reachable and every transition names states that exist.INFONo state is marked `final`, so this machine never terminates. That is ordinary for a reactive controller and a smell for a workflow.OKAll 4 states are reachable from `Disconnected`.OKAll 6 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Connection lifecycle"
state Disconnected
state Connecting
state Connected
state Reconnecting
initial Disconnected
transition Disconnected -> Connecting on "connect"
transition Connecting -> Connected on "established"
transition Connecting -> Disconnected on "fail"
transition Connected -> Reconnecting on "drop"
transition Reconnecting -> Connected on "restored"
transition Reconnecting -> Disconnected on "give_up"