MessagePortToChannelX extension

Bridge Web Worker ports to structured channel processing.

Convert raw MessagePort communication to type-safe channel operations. Essential for building robust Web Worker architectures with proper error handling and message flow control.

on
  • MessagePort

Methods

toChannel<T>(ChannelType type, {int? capacity, DropPolicy policy = DropPolicy.block, OnDrop<T>? onDrop, bool chunked = true, bool strict = true}) → (dynamic, dynamic)

Available on MessagePort, provided by the MessagePortToChannelX extension

Convert port messages to a channel with unified API.
toMpmc<T>({int? capacity, DropPolicy policy = DropPolicy.block, OnDrop<T>? onDrop, bool chunked = true, bool strict = true}) → (MpmcSender<T>, MpmcReceiver<T>)

Available on MessagePort, provided by the MessagePortToChannelX extension

Convert port messages to MPMC channel (legacy method).
toMpsc<T>({int? capacity, DropPolicy policy = DropPolicy.block, OnDrop<T>? onDrop, bool chunked = true, bool strict = true}) → (MpscSender<T>, MpscReceiver<T>)

Available on MessagePort, provided by the MessagePortToChannelX extension

Convert port messages to MPSC channel (legacy method).