Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
WebRTCDataChannel¶
Inherits: PacketPeer < RefCounted < Object
Inherited By: WebRTCDataChannelExtension
There is currently no description for this class. Please help us by contributing one!
Properties¶
|
Methods¶
void |
close ( ) |
get_buffered_amount ( ) const |
|
get_id ( ) const |
|
get_label ( ) const |
|
get_max_packet_life_time ( ) const |
|
get_max_retransmits ( ) const |
|
get_protocol ( ) const |
|
get_ready_state ( ) const |
|
is_negotiated ( ) const |
|
is_ordered ( ) const |
|
poll ( ) |
|
was_string_packet ( ) const |
Enumerations¶
enum WriteMode:
WriteMode WRITE_MODE_TEXT = 0
告诉通道以文本形式在这个通道上发送数据。外部对等体(非 Godot)会以字符串的形式接收。
WriteMode WRITE_MODE_BINARY = 1
告诉通道以二进制形式在此通道上发送数据。外部对等体(非 Godot)将以数组缓冲区或 blob 的形式接收。
enum ChannelState:
ChannelState STATE_CONNECTING = 0
通道已经创建,但它仍在尝试连接。
ChannelState STATE_OPEN = 1
该通道目前是打开的,数据可以在其上流动。
ChannelState STATE_CLOSING = 2
通道正在关闭,将不接受新的消息,但已经在队列中的消息将被刷新。
ChannelState STATE_CLOSED = 3
通道已关闭,或连接失败。
Property Descriptions¶
WriteMode write_mode = 1
发送出去数据包时要使用的传输模式。可以是文本或二进制。
Method Descriptions¶
void close ( )
关闭此数据通道,通知另一个对等体。
int get_buffered_amount ( ) const
返回当前排队在此通道上发送的字节数。
int get_id ( ) const
返回创建时分配给该通道的 ID(或是在协商时自动分配的)。
如果该通道没有进行带外协商,那么该 ID 将只在连接建立后可用(在此之前将返回 65535
)。
String get_label ( ) const
返回创建时分配给该通道的标签。
int get_max_packet_life_time ( ) const
返回创建时分配给这个通道的 maxPacketLifeTime
值。
如果没有指定,将是 65535
。
int get_max_retransmits ( ) const
返回创建时分配给这个通道的 maxRetransmits
值。
如果没有指定,将是 65535
。
String get_protocol ( ) const
返回创建时分配给这个通道的子协议。如果没有指定,则为空字符串。
ChannelState get_ready_state ( ) const
返回该通道的当前状态,见 ChannelState。
bool is_negotiated ( ) const
如果这个通道是用带外配置创建的,返回 true
。
bool is_ordered ( ) const
如果这个通道在创建时启用了排序功能,则默认返回 true
。
Error poll ( )
保留,目前未使用。
bool was_string_packet ( ) const
如果最后收到的数据包是以文本形式传输,则返回 true
。见 write_mode。