Skip to main content

namespace RemoteChannel

A RemoteChannel is a channel that communicates through a message port of the RemoteChannel.SimpleMessagePort type. This makes it usable for cross-environment channel communication, e.g. cross threads or even cross network. Like CrossChannel, RemoteChannel does not receive its own sent messages, but requires another end to communicate.

Interfaces

NameDescription
RemoteChannel.ConstructorsDefines the static RemoteChannel API.
RemoteChannel.CrossConfigInterface defining the cross-channel configuration for a RemoteChannel.
RemoteChannel.ReadConfigInterface defining the read configuration for a RemoteChannel.
RemoteChannel.SimpleMessagePortInterface used to perform low-level message communication between processes. Compatible with browser, Node, and Worker contexts.
RemoteChannel.WriteConfigInterface defining the write configuration for a RemoteChannel.

Static Methods

createCross

Resolves to a new cross-channel RemoteChannel using the given configuration.

Definition

createCross<TSend = void, TReceive = TSend>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.CrossConfig): Promise<CrossChannel<TSend, TReceive>>;

Type parameters

NameDefaultDescription
TSendvoidthe send message type
TReceiveTSendthe receive message type

Parameters

NameTypeDescription
portRemoteChannel.SimpleMessagePort
configRemoteChannel.CrossConfigthe channel configuration

createRead

Resolves to a new read-only RemoteChannel using the given configuration.

Definition

createRead<T = void>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.ReadConfig): Promise<Channel.Read<T>>;

Type parameters

NameDefaultDescription
Tvoidthe message type

Parameters

NameTypeDescription
portRemoteChannel.SimpleMessagePort
configRemoteChannel.ReadConfigthe channel configuration

createWrite

Resolves to a new write-only RemoteChannel using the given configuration.

Definition

createWrite<T = void>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.WriteConfig): Promise<Channel.Write<T>>;

Type parameters

NameDefaultDescription
Tvoidthe message type

Parameters

NameTypeDescription
portRemoteChannel.SimpleMessagePort
configRemoteChannel.WriteConfigthe channel configuration