Class: Channel

Channel

Represents a communication channel between a frontend client and a kernel server.

Classes

Channel

Members

handler :object

The object that handles calls from the server.
Type:
  • object

Methods

(async) call(name, …args) → {any}

Makes a call to the server.
Parameters:
Name Type Attributes Description
name string The name of a server handler method.
args any <repeatable>
The arguments of the call.
Returns:
The return value of the method.
Type
any

(async) callWithStream(name, stream, …args) → {any}

Makes a call to the server with a byte stream as its first argument. The method receives it as a server MetaGenerator.
Parameters:
Name Type Attributes Description
name string The name of a server handler method.
stream object The first argument of the call, an async iterable of Uint8Array instances.
args any <repeatable>
The other arguments of the call.
Returns:
The return value of the method.
Type
any

(async) echo(…args) → {Array}

Sends arguments to the server and receives them back. Under normal circumstances, this method should not be called. It should only be called for debugging or testing purposes. It is particularly useful to verify whether the arguments are robust to JSON serialization and deserialization.
Parameters:
Name Type Attributes Description
args any <repeatable>
The arguments.
Returns:
The same arguments as an array.
Type
Array

(async) pipe(stream) → {MetaGenerator}

Sends a byte stream to the server and receives it back. Under normal circumstances, this method should not be called. It should only be called for debugging or testing purposes. It is particularly useful to verify whether the bytes are robust to GET and POST streaming.
Parameters:
Name Type Description
stream object An async iterable of Uint8Array instances.
Returns:
The same bytes as a meta generator.
Type
MetaGenerator