MessageChannelTransport
Defined in: src/cluster/transports/MessageChannelTransport.ts:38
Transport that talks to the rest of the cluster through a single pair of
MessagePorts — this node holds one end; a broker (typically the
main-thread WorkerCluster) holds the other end of every worker and
forwards traffic based on the envelope’s to address. Use this to
build a multi-core cluster inside one process without paying the TCP
overhead.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MessageChannelTransport(
self,port):MessageChannelTransport
Defined in: src/cluster/transports/MessageChannelTransport.ts:45
Parameters
Section titled “Parameters”Returns
Section titled “Returns”MessageChannelTransport
Properties
Section titled “Properties”
readonlyself:NodeAddress
Defined in: src/cluster/transports/MessageChannelTransport.ts:39
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”disconnect()
Section titled “disconnect()”disconnect(
_peer):void
Defined in: src/cluster/transports/MessageChannelTransport.ts:74
Close the connection to a peer.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”peers()
Section titled “peers()”peers():
NodeAddress[]
Defined in: src/cluster/transports/MessageChannelTransport.ts:78
Peers currently connected (either inbound or outbound).
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”send()
Section titled “send()”send(
to,msg):void
Defined in: src/cluster/transports/MessageChannelTransport.ts:64
Best-effort fire-and-forget send. Opens a connection on first use.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setHandler()
Section titled “setHandler()”setHandler(
handler):void
Defined in: src/cluster/transports/MessageChannelTransport.ts:50
Parameters
Section titled “Parameters”handler
Section titled “handler”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”shutdown()
Section titled “shutdown()”shutdown():
Promise<void>
Defined in: src/cluster/transports/MessageChannelTransport.ts:58
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”start()
Section titled “start()”start():
Promise<void>
Defined in: src/cluster/transports/MessageChannelTransport.ts:52
Returns
Section titled “Returns”Promise<void>