Channel
A streaming channel pair created bycreateChannel(), containing both local handles and serializable references.
- TypeScript
- Python
- Rust
Fields
ChannelWriter
required
Local writer for sending data through the channel.
ChannelReader
required
Local reader for receiving data from the channel.
StreamChannelRef
required
Serializable reference to the writer endpoint. Pass this to other workers to allow them to write to this channel.
StreamChannelRef
required
Serializable reference to the reader endpoint. Pass this to other workers to allow them to read from this channel.
StreamChannelRef
A serializable reference to a channel endpoint that can be passed in function invocation data.- TypeScript
- Python
- Rust
Fields
string
required
Unique identifier for the channel.
string
required
Secret access key for authenticating to the channel endpoint.
'read' | 'write'
required
Whether this reference is for reading from or writing to the channel.
ChannelWriter
Writer endpoint for sending data through a channel.- TypeScript
- Python
- Rust
Properties
WritableStream
required
Node.js Writable stream interface for sending binary data.
Methods
function
Write binary data to the channel. Data is automatically chunked into frames.
function
Send a text message through the channel (separate from binary data stream).
function
Close the writer endpoint and signal completion to the reader.
ChannelReader
Reader endpoint for receiving data from a channel.- TypeScript
- Python
- Rust
Properties
ReadableStream
required
Node.js Readable stream interface for receiving binary data.
Methods
function
Register a callback to receive text messages (separate from binary data stream).
function
Read the next binary chunk from the channel. Returns
None when stream is closed.function
Read the entire stream into a single buffer.
function
Close the reader endpoint.
Usage Examples
Basic Channel Communication
- TypeScript
- Python
- Rust
Receiving Channel Reference
- TypeScript
- Python
- Rust
Streaming Large Files
- TypeScript
- Python
- Rust
Configuration
Buffer Size
When creating a channel, you can optionally specify a buffer size:- TypeScript
- Python
- Rust