Skip to content
Liminal

Events

Client.events is the event stream for a client protocol.

Events arrive as a tagged union keyed by _tag.

.(function* () {
  yield* ..(
    .(
      .(function* () {
        switch (.) {
          case "AwaitingPartner": {
            break
          }
          case "GameStarted": {
            const {  } = 
            break
          }
          case "MoveMade": {
            const { ,  } = 
            break
          }
          case "GameEnded": {
            const {  } = 
            break
          }
        }
      }),
    ),
  )
})

For larger apps, many screens should not consume Client.events directly. Feed the event stream into an Client State instead.

Replay

Replay only affects client.events.

.({
  : ,
  : "/play",
  : {
    : "startup",
    : 16,
  },
  : {},
})

Important details:

  • No replay: subscribers only see events once they are connected.
  • mode: "startup": the first subscriber gets the buffered events once.
  • mode: "all-subscribers": every subscriber gets the buffer.
  • limit caps buffer size. When omitted, the buffer is unbounded.
  • Method successes and failures are never replayed.