Home > @rainway/native > DataChannel
DataChannel class
A data channel from our device to another Peer on the Rainway Network.
Signature:
export declare class DataChannel extends EventEmitter<DataChannelEvents>
Extends: EventEmitter<DataChannelEvents>
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the DataChannel class.
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| id | string | The id (label) of the data channel. | |
| mode | RainwayChannelMode | The mode of the data channel. | |
| peer | Peer | The peer that owns this data channel. |
Methods
| Method | Modifiers | Description |
|---|---|---|
| request(data) | Sends a binary *request* message via this data channel. Awaits a response, and returns a promise that resolves to it. If a string is given, it will be utf-8 encoded before transmission. | |
| request(data) | ||
| send(data) | Sends a binary message via this data channel. If a string is given, it will be utf-8 encoded before transmission. |
