WebRTCDataChannel

继承: PacketPeer < RefCounted < Object

派生: WebRTCDataChannelExtension

该类目前没有描述,请帮我们\ :ref:贡献一个 <doc_updating_the_class_reference>\ 吧!

属性

方法


枚举

enum WriteMode:

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.

WriteMode 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:

ChannelState STATE_CONNECTING = 0

The channel was created, but it's still trying to connect.

ChannelState STATE_OPEN = 1

The channel is currently open, and data can flow over it.

ChannelState STATE_CLOSING = 2

The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.

ChannelState STATE_CLOSED = 3

The channel was closed, or connection failed.


属性说明

WriteMode write_mode = 1

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


方法说明

void close ( )

Closes this data channel, notifying the other peer.


int get_buffered_amount ( ) const1

Returns the number of bytes currently queued to be sent over this channel.


int get_id ( ) const1

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


String get_label ( ) const1

Returns the label assigned to this channel during creation.


int get_max_packet_life_time ( ) const1

Returns the maxPacketLifeTime value assigned to this channel during creation.

Will be 65535 if not specified.


int get_max_retransmits ( ) const1

Returns the maxRetransmits value assigned to this channel during creation.

Will be 65535 if not specified.


String get_protocol ( ) const1

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


ChannelState get_ready_state ( ) const1

Returns the current state of this channel, see ChannelState.


bool is_negotiated ( ) const1

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


bool is_ordered ( ) const1

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


Error poll ( )

Reserved, but not used for now.


bool was_string_packet ( ) const1

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

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。