- Notifications
You must be signed in to change notification settings - Fork3
WebRTC Data Channel Establishment Protocol
License
nodertc/datachannel
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
WebRTC Data Channel Establishment Protocol. Supported RFC:
const{ createChannel}=require('@nodertc/datachannel');constinput=createSctpSourceStream({id:1});constoutput=createSctpTargetStream({id:1});constchannel=createChannel({ input, output,label:'nodertc'});channel.on('data',data=>{console.log('Channel %s says:',channel.label,data.toString())});
createChannel(options: Options): Channel
Creates the Data Channel.
Options.input: stream.Readable
Source stream.
Options.output: stream.Writable
Target stream.
Options.negotiated: boolean, default false
The default value of false tells the user agent to announce the channel in-band and instruct the other peer to dispatch a corresponding Channel object. If set to true, it is up to the application to negotiate the channel.
Options.label: string, default ""
A label that can be used to distinguish this Channel object from other one.
Options.protocol: string, default ""
Subprotocol name used for this channel.
Options.priority: number, default 0
Priority of this channel.
Options.ordered: boolean, default false
The type of the delivery. Defaultfalse
.
Options.retries: number, optional
The number of retransmissions.
Options.lifetime: number, optional
The maximum lifetime in milliseconds.
class Channel
This class is an abstraction of the Data Channel. AChannel
is also aduplex stream, so it can be both readable and writable, and it is also aEventEmitter.
Channel.label: string, readonly
The name of the Data Channel.
Channel.priority: number, readonly
The priority of the Data Channel.
Channel.protocol: string, readonly
The name of a protocol registered in the'WebSocket Subprotocol Name Registry'.
Channel.type: number, readonly
Get the channel type.
Channel.ordered: boolean, readonly
Get the type of the delivery.
Channel.negotiated: boolean, readonly
Returns true if the Data Channel was negotiated by the application, or false otherwise.
Channel.reliability: number, readonly
For reliable Data Channels this field MUST be set to 0 on the sending side and MUST be ignored on the receiving side. If a partial reliable Data Channel with limited number of retransmissions is used, this field specifies the number of retransmissions. If a partial reliable Data Channel with limited lifetime is used, this field specifies the maximum lifetime in milliseconds.
Channel.close()
Closes the channel. Theinput
andoutput
channels keeps untouched.
MIT, 2018 © Dmitriy Tsvettsikh
About
WebRTC Data Channel Establishment Protocol