Channel class abstract
A Channel supports communication from a client to a platform worker. It is used to send a WorkerRequest to a platform worker.
Constructors
- Channel()
Properties
Methods
-
close(
) → FutureOr - Sends a termination WorkerRequest to the worker. The Channel should release any resource related to the worker and should not be used after this method has been called.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendRequest<
T> (int command, List args, {CancellationToken? token, bool inspectRequest = false, bool inspectResponse = false}) → Future< T> - Creates a WorkerRequest and sends it to the worker. This method expects a single value from the worker.
-
sendStreamingRequest<
T> (int command, List args, {SquadronCallback onDone = Channel.noop, CancellationToken? token, bool inspectRequest = false, bool inspectResponse = false}) → Stream< T> -
Creates a WorkerRequest and sends it to the worker. This method expects a stream of values from the worker.
The worker must send a
WorkerResponse.closeStream
message to close the Stream. -
serialize(
) → dynamic - Channel serialization. Returns an opaque object that can be transfered from the client to the worker.
- Channel sharing. Returns a Channel object that can be provided to enable another worker to call the channel's worker.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
deserialize(
dynamic channelInfo) → Channel? -
Deserializes a Channel from an opaque
channelInfo
. -
noop(
) → void - Static method that does nothing. Useful when a SquadronCallback is required but there is nothing to do.
-
open(
dynamic entryPoint, String workerId, List startArguments, [PlatformWorkerHook? hook]) → Future< Channel> -
Starts a worker using the
entryPoint
and sends a start WorkerRequest withstartArguments
. The future must not complete before the worker is ready to serve requests.