Interface: ChannelsApi

Creates typed views of named realtime channels.

Methods

channel()

channel<T>(name, options?): Channel<T>

Returns a channel with the requested name and outgoing delivery behavior. Names contain 1–128 characters and at most 130 UTF-8 JSON bytes. Subscriptions are identified only by name and receive either delivery mode. Selecting the same name and mode returns the same object; selecting it with conflicting options throws.

The payload type is an unchecked compile-time assertion for autocomplete. Omit it for an untyped sender whose received payload is JsonValue. Payloads must still be valid JSON and are checked every time a message is sent. Omitting delivery selects ChannelDelivery.Reliable. Creating a channel does not start readiness and is safe before Plot.ready().

Type Parameters

T

T = unknown

The unchecked compile-time shape of this channel's payload.

Parameters

name

string

The stable name shared by every sender and subscriber.

options?

ChannelOptions

Optional outgoing delivery behavior.

Returns

Channel<T>

The shared channel object for this name and delivery mode.

Throws

TypeError when the name or channel options are invalid.