WebRTCPeerConnectionCreateDataChannel Method |
Returns a new WebRTCDataChannel (or null on failure) with given label and optionally configured via the options dictionary. This method can only be called when the connection is in state .
There are two ways to create a working data channel: either call CreateDataChannel(String, Dictionary) on only one of the peer and listen to data_channel_received on the other, or call CreateDataChannel(String, Dictionary) on both peers, with the same values, and the negotiated option set to true.
Valid options are:
{ "negotiated": true, # When set to true (default off), means the channel is negotiated out of band. "id" must be set too. data_channel_received will not be called. "id": 1, # When "negotiated" is true this value must also be set to the same value on both peer. # Only one of maxRetransmits and maxPacketLifeTime can be specified, not both. They make the channel unreliable (but also better at real time). "maxRetransmits": 1, # Specify the maximum number of attempt the peer will make to retransmits packets if they are not acknowledged. "maxPacketLifeTime": 100, # Specify the maximum amount of time before giving up retransmitions of unacknowledged packets (in milliseconds). "ordered": true, # When in unreliable mode (i.e. either "maxRetransmits" or "maxPacketLifetime" is set), "ordered" (true by default) specify if packet ordering is to be enforced. "protocol": "my-custom-protocol", # A custom sub-protocol string for this channel. }
Note: You must keep a reference to channels created this way, or it will be closed.
Namespace: Godot
public WebRTCDataChannel CreateDataChannel( string label, Dictionary options = null )
[Missing <param name="label"/> documentation for "M:Godot.WebRTCPeerConnection.CreateDataChannel(System.String,Godot.Collections.Dictionary)"]
[Missing <returns> documentation for "M:Godot.WebRTCPeerConnection.CreateDataChannel(System.String,Godot.Collections.Dictionary)"]