WebRTCDataChannel

Inherits: PacketPeer < Reference < Object

Inherited By: WebRTCDataChannelGDNative

Enumerations

enum WriteMode:

  • WRITE_MODE_TEXT = 0 — Tells the channel to send data over this channel as text. An external peer (non-Godot) would receive this as a string.
  • WRITE_MODE_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.

enum ChannelState:

  • STATE_CONNECTING = 0 — The channel was created, but it’s still trying to connect.
  • STATE_OPEN = 1 — The channel is currently open, and data can flow over it.
  • STATE_CLOSING = 2 — The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.
  • STATE_CLOSED = 3 — The channel was closed, or connection failed.

Property Descriptions

Default1
Setterset_write_mode(value)
Getterget_write_mode()

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

Method Descriptions

  • void close ( )

Closes this data channel, notifying the other peer.


  • int get_id ( ) const

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


Returns the label assigned to this channel during creation.


  • int get_max_packet_life_time ( ) const

Returns the maxPacketLifeTime value assigned to this channel during creation.

Will be 65535 if not specified.


  • int get_max_retransmits ( ) const

Returns the maxRetransmits value assigned to this channel during creation.

Will be 65535 if not specified.


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


Returns the current state of this channel, see ChannelState.


  • bool is_negotiated ( ) const

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


  • bool is_ordered ( ) const

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


Reserved, but not used for now.


  • bool was_string_packet ( ) const

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

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.