WorkerRequestImpl extension

Extension methods operating on a List as a WorkerRequest. WorkerRequests are used to communicate from a Channel to a Worker. Typically a WorkerRequest consists of a command ID and a list of arguments. The command ID is used by the Worker to dispatch the WorkerRequest to the method responsible for handling it. The command's arguments are passed as a list and should only contain primitive values or objects that can be transfered across workers. For applications running on a VM platform, Dart objects should be safe according to Dart's documentation of SendPort.send. WorkerRequestImpl also implements specific requests used for worker startup, stream/token cancellation, worker termination...

on

Properties

args List
The command's arguments, if any.
no setter
cancelToken CancellationToken?
Cancellation token.
no setter
channelInfo → dynamic
The client's channel info.
no setter
client WorkerChannel?
The client's WorkerChannel. Only valid on the receiving end.
no setter
command int
The command's ID.
no setter
id String?
The ID of the worker that initiated the command (only used for connection commands).
no setter
inspectResponse bool
Flag indicating whether the Channel should inspect the payload to identify non-base type objects. In Web workers, ownership of these objects must be transfered across threads.
no setter
isCancellation bool
flag for cancellation requests.
no setter
isConnection bool
flag for start requests.
no setter
isStreamCancellation bool
flag for stream cancellation requests.
no setter
isTermination bool
flag for termination requests.
no setter
logLevel int?
The current Squadron log level. This is set automatically and only used for connection commands.
no setter
reply → (void Function(dynamic)?)
The channel method to be used for sending data back.
no setter
streamId int?
Stream id.
no setter

Static Methods

cancel(CancellationToken token) WorkerRequest
Creates a new cancellation request.
cancelStream(int streamId) WorkerRequest
Creates a new stream cancellation request.
start(dynamic channelInfo, String id, List args) WorkerRequest
Creates a new start request.
stop() WorkerRequest
Creates a new termination request.
userCommand(dynamic channelInfo, int command, List args, CancellationToken? token, bool inspectResponse) WorkerRequest
Creates a new request with the specified command ID and optional arguments.