Skip to content

Instantly share code, notes, and snippets.

@justinramel
Last active March 31, 2020 21:31
Show Gist options
  • Save justinramel/7a9d3501f4240271eb83bfaa9b0e750a to your computer and use it in GitHub Desktop.
Save justinramel/7a9d3501f4240271eb83bfaa9b0e750a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const socketMachine = Machine({
id: 'socketMachine',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
CONNECT: 'connecting',
ERROR: 'error'
}
},
connecting: {
on: {
CONNECTED: 'open',
ERROR: 'error'
}
},
open: {
on: {
SEND: 'open',
CLOSE: 'closing',
ERROR: 'error'
}
},
closing: {
on: {
CLOSED: 'closed'
}
},
closed: {
on: {
CONNECT: 'connecting'
}
},
error: {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment