actions/transports.ts

Transport abstraction for action communication.

Provides the Transport interface and Transports registry for managing multiple transports with fallback behavior.

Declarations
#

7 declarations

view source

Transport
#

TransportName
#

Transports
#

actions/transports.ts view source

allow_fallback

Whether to allow fallback to other transports if the current one is not available.

type boolean

register_transport

Registers a transport. The first transport registered also becomes the current.

type (transport: Transport): void

transport
returns void

set_current_transport

Switch the current transport selection by name.

type (transport_name: string): void

transport_name
type string
returns void
throws
  • Error - if no transport with `transport_name` has been registered

get_transport

Resolve a transport. With allow_fallback, walks specified → current → any-ready; without, returns the named transport (or current) only when it's ready.

type (transport_name?: string | undefined): Transport | null

transport_name?
type string | undefined
optional
returns Transport | null

the resolved transport, or null when none is ready

is_ready

type (): boolean | null

returns boolean | null

get_current_transport

type (): Transport | null

returns Transport | null

get_current_transport_name

type (): string | null

returns string | null

get_transport_by_name

type (transport_name: string): Transport | null

transport_name
type string
returns Transport | null

TransportSendOptions
#

actions/transports.ts view source

TransportSendOptions

Per-call options accepted by every transport's send. Optional and extensible — adding a field is non-breaking. Source of truth for the shared option shape; ActionPeerSendOptions and RpcClientCallOptions extend it.

signal

Per-call cancellation. Bottoms out at FrontendWebsocketClient.request({signal}) on the WS path (sends the shared cancel notification on abort) and at fetch({signal}) on HTTP. Backend transport has no per-call abort surface to honor.

type AbortSignal

queue

Per-call durable-queue opt-in. Names the client-authoritative vs server-authoritative distinction — server-authoritative consumers (e.g. zzz completion calls) fail fast with service_unavailable when the transport is down; client-authoritative consumers (games, real-time apps) buffer and replay on reconnect because the user already committed to the action at click time. Honored only by FrontendWebsocketTransport on the request_response path (default false). HTTP and backend transports ignore it; WS notifications also ignore it and always fail-fast when disconnected (fire-and-forget connection.send has no queue semantic).

type boolean

WS_CLOSE_CLIENT_HEARTBEAT_TIMEOUT
#

WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT
#

WS_CLOSE_SESSION_REVOKED
#

Imported by
#