public abstract class WebRTCDataChannel : PacketPeer

Inheritance Chain

Derived Classes

Properties

    public WriteModeEnum WriteMode { get; set; }

The transfer mode to use when sending outgoing packet. Either text or binary.

Methods

    public void Close()

Closes this data channel, notifying the other peer.

    public int GetId()

Returns the id assigned to this channel during creation (or auto-assigned during negotiation).

If the channel is not negotiated out-of-band the id will only be available after the connection is established (will return 65535 until then).

    public string GetLabel()

Returns the label assigned to this channel during creation.

    public int GetMaxPacketLifeTime()

Returns the maxPacketLifeTime value assigned to this channel during creation.

Will be 65535 if not specified.

    public int GetMaxRetransmits()

Returns the maxRetransmits value assigned to this channel during creation.

Will be 65535 if not specified.

    public string GetProtocol()

Returns the sub-protocol assigned to this channel during creation. An empty string if not specified.

    public ChannelState GetReadyState()

Returns the current state of this channel, see ChannelState.

    [Obsolete("GetWriteMode is deprecated. Use the WriteMode property instead.")]
    public WriteModeEnum GetWriteMode()

Getter for WriteMode

    public bool IsNegotiated()

Returns true if this channel was created with out-of-band configuration.

    public bool IsOrdered()

Returns true if this channel was created with ordering enabled (default).

    public Error Poll()

Reserved, but not used for now.

    [Obsolete("SetWriteMode is deprecated. Use the WriteMode property instead.")]
    public void SetWriteMode(WriteModeEnum writeMode)

Setter for WriteMode

    public bool WasStringPacket()

Returns true if the last received packet was transferred as text. See WriteMode.

Inner Types

ChannelState

Name Value Description
Connecting 0 The channel was created, but it’s still trying to connect.
Open 1 The channel is currently open, and data can flow over it.
Closing 2 The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.
Closed 3 The channel was closed, or connection failed.

WriteModeEnum

Name Value Description
Text 0 Tells the channel to send data over this channel as text. An external peer (non-Godot) would receive this as a string.
Binary 1 Tells the channel to send data over this channel as binary. An external peer (non-Godot) would receive this as array buffer or blob.
Tags: