HomeGuidesAPI Reference
HubBlogChangelogSupport ForumLog In
API Reference

Node.js SDK - DataChannel

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

PropertyModifiersTypeDescription
idstringThe id (label) of the data channel.
modeRainwayChannelModeThe mode of the data channel.
peerPeerThe peer that owns this data channel.

Methods

MethodModifiersDescription
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.