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.

WebRTCDataChannel

繼承: PacketPeer < RefCounted < Object

被繼承: WebRTCDataChannelExtension

There is currently no description for this class. Please help us by contributing one!

屬性

WriteMode

write_mode

1

方法

void

close()

int

get_buffered_amount() const

int

get_id() const

String

get_label() const

int

get_max_packet_life_time() const

int

get_max_retransmits() const

String

get_protocol() const

ChannelState

get_ready_state() const

bool

is_negotiated() const

bool

is_ordered() const

Error

poll()

bool

was_string_packet() const


列舉

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

通道已關閉,或連接失敗。


屬性說明

WriteMode write_mode = 1 🔗

發送出去封包時要使用的傳輸模式。可以是文字或二進位。


方法說明

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 🔗

Returns the current state of this channel.


bool is_negotiated() const 🔗

如果這個通道是用帶外配置建立的,返回 true


bool is_ordered() const 🔗

如果這個通道在建立時啟用了排序功能,則預設返回 true


Error poll() 🔗

保留,目前未使用。


bool was_string_packet() const 🔗

如果最後收到的封包是以文字形式傳輸,則返回 true。見 write_mode