HomeGuidesAPI Reference
HubBlogChangelogSupport ForumLog In
API Reference

Web SDK - Peer.createDataChannel()

Home > @rainway/web > Peer > createDataChannel

Peer.createDataChannel() method

Create a new data channel for exchanging application-level data with this peer. The returned Promise resolves once the new data channel has been opened.

If an error prevents the channel from being created or opened, the promise rejects with a RainwayError.

As a rule, the party that requested the peer-to-peer connection should create the data channels. This means you should call this function on a RainwayPeer you get from RainwayConnection.connect, and not elsewhere.

See: https://docs.rainway.com/docs/data-channels

Signature:

createDataChannel(options: OpenDataChannelOptions): Promise<DataChannel>;

Parameters

ParameterTypeDescription
optionsOpenDataChannelOptionsA name and mode for the data channel.

Returns:

Promise<DataChannel>