Skip to main content

namespace CrossChannel

A CrossChannel is a channel of which the send and receive modules are not internally connected. This means that the send and receive message types can also differ. A normal Channel can receive its own message, but a CrossChannel cannot, and so they are usually created in pairs to perform bidirectional communication with some other entity.

Companion interface: CrossChannel<TSend,TReceive>

Interfaces

NameDescription
CrossChannel.ConfigConfiguration options for creating a CrossChannel
CrossChannel.ConstructorsDefines the static CrossChannel API.

Static Methods

combine

Returns a CrossChannel where the send module comprises the given writeCh, and the receive module conists of the given readCh.

Definition

combine<TSend = void, TReceive = TSend>(writeCh: Channel.Write<TSend>, readCh: Channel.Read<TReceive>): CrossChannel<TSend, TReceive>;

Type parameters

NameDefaultDescription
TSendvoidthe send message type
TReceiveTSendthe receive message type

Parameters

NameTypeDescription
writeChChannel.Write<TSend>the write channel to use for sending messages
readChChannel.Read<TReceive>the read channel to use for receiving messages

createPair

Returns a pair of connected CrossChannels of which the send module of the first is connected to the receive module of the second, and the send module of the second is connected to the receive module of the first.

Definition

createPair<TSend = void, TReceive = TSend>(config?: CrossChannel.Config): CrossChannel.Pair<TSend, TReceive>;

Type parameters

NameDefaultDescription
TSendvoidthe send message type
TReceiveTSendthe receive message type

Parameters

NameTypeDescription
configCrossChannel.Config