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
| Name | Description |
|---|---|
RemoteChannel.Constructors | Defines the static RemoteChannel API. |
RemoteChannel.CrossConfig | Interface defining the cross-channel configuration for a RemoteChannel. |
RemoteChannel.ReadConfig | Interface defining the read configuration for a RemoteChannel. |
RemoteChannel.SimpleMessagePort | Interface used to perform low-level message communication between processes. Compatible with browser, Node, and Worker contexts. |
RemoteChannel.WriteConfig | Interface defining the write configuration for a RemoteChannel. |
Static Methods
createCross
Resolves to a new cross-channel RemoteChannel using the given configuration.
createCrossDefinition
createCross<TSend = void, TReceive = TSend>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.CrossConfig): Promise<CrossChannel<TSend, TReceive>>;
Type parameters
| Name | Default | Description |
|---|---|---|
| TSend | void | the send message type |
| TReceive | TSend | the receive message type |
Parameters
| Name | Type | Description |
|---|---|---|
port | RemoteChannel.SimpleMessagePort | |
config | RemoteChannel.CrossConfig | the channel configuration |
createRead
Resolves to a new read-only RemoteChannel using the given configuration.
createReadDefinition
createRead<T = void>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.ReadConfig): Promise<Channel.Read<T>>;
Type parameters
| Name | Default | Description |
|---|---|---|
| T | void | the message type |
Parameters
| Name | Type | Description |
|---|---|---|
port | RemoteChannel.SimpleMessagePort | |
config | RemoteChannel.ReadConfig | the channel configuration |
createWrite
Resolves to a new write-only RemoteChannel using the given configuration.
createWriteDefinition
createWrite<T = void>(port: RemoteChannel.SimpleMessagePort, config: RemoteChannel.WriteConfig): Promise<Channel.Write<T>>;
Type parameters
| Name | Default | Description |
|---|---|---|
| T | void | the message type |
Parameters
| Name | Type | Description |
|---|---|---|
port | RemoteChannel.SimpleMessagePort | |
config | RemoteChannel.WriteConfig | the channel configuration |