Primitives / foldkit-primitives/net

SocketView

const · packages/primitives/src/net/websocket.ts:57

const SocketView: TaggedUnion<{
  readonly Disconnected: {}
  readonly Connecting: {}
  readonly Connected: {}
  readonly Error: { readonly error: Schema.String }
}>

Its type

type SocketView = typeof SocketView.Type

What the reader sees: the socket's state, or its error. A page derives this instead of keeping its own connection state machine. lastError is already worded for the reader (Failed to connect to WebSocket, never the socket's own text, which error handling drops in favor of the sentence).

In the guides