Files
godot-docs/classes/class_webrtcdatachannel.rst

326 lines
13 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/webrtc/doc_classes/WebRTCDataChannel.xml.
.. _class_WebRTCDataChannel:
WebRTCDataChannel
=================
**Inherits:** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`WebRTCDataChannelExtension<class_WebRTCDataChannelExtension>`
.. container:: contribute
There is currently no description for this class. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+----------------------------------------------------+----------------------------------------------------------------+-------+
| :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` | :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>` | ``1`` |
+----------------------------------------------------+----------------------------------------------------------------+-------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| |void| | :ref:`close<class_WebRTCDataChannel_method_close>`\ (\ ) |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_buffered_amount<class_WebRTCDataChannel_method_get_buffered_amount>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_id<class_WebRTCDataChannel_method_get_id>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_label<class_WebRTCDataChannel_method_get_label>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_max_packet_life_time<class_WebRTCDataChannel_method_get_max_packet_life_time>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_max_retransmits<class_WebRTCDataChannel_method_get_max_retransmits>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_protocol<class_WebRTCDataChannel_method_get_protocol>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` | :ref:`get_ready_state<class_WebRTCDataChannel_method_get_ready_state>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_negotiated<class_WebRTCDataChannel_method_is_negotiated>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_ordered<class_WebRTCDataChannel_method_is_ordered>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`poll<class_WebRTCDataChannel_method_poll>`\ (\ ) |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`was_string_packet<class_WebRTCDataChannel_method_was_string_packet>`\ (\ ) |const| |
+----------------------------------------------------------+--------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_WebRTCDataChannel_WriteMode:
.. rst-class:: classref-enumeration
enum **WriteMode**: :ref:`🔗<enum_WebRTCDataChannel_WriteMode>`
.. _class_WebRTCDataChannel_constant_WRITE_MODE_TEXT:
.. rst-class:: classref-enumeration-constant
:ref:`WriteMode<enum_WebRTCDataChannel_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.
.. _class_WebRTCDataChannel_constant_WRITE_MODE_BINARY:
.. rst-class:: classref-enumeration-constant
:ref:`WriteMode<enum_WebRTCDataChannel_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.
.. rst-class:: classref-item-separator
----
.. _enum_WebRTCDataChannel_ChannelState:
.. rst-class:: classref-enumeration
enum **ChannelState**: :ref:`🔗<enum_WebRTCDataChannel_ChannelState>`
.. _class_WebRTCDataChannel_constant_STATE_CONNECTING:
.. rst-class:: classref-enumeration-constant
:ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **STATE_CONNECTING** = ``0``
The channel was created, but it's still trying to connect.
.. _class_WebRTCDataChannel_constant_STATE_OPEN:
.. rst-class:: classref-enumeration-constant
:ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **STATE_OPEN** = ``1``
The channel is currently open, and data can flow over it.
.. _class_WebRTCDataChannel_constant_STATE_CLOSING:
.. rst-class:: classref-enumeration-constant
:ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **STATE_CLOSING** = ``2``
The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.
.. _class_WebRTCDataChannel_constant_STATE_CLOSED:
.. rst-class:: classref-enumeration-constant
:ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **STATE_CLOSED** = ``3``
The channel was closed, or connection failed.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_WebRTCDataChannel_property_write_mode:
.. rst-class:: classref-property
:ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` **write_mode** = ``1`` :ref:`🔗<class_WebRTCDataChannel_property_write_mode>`
.. rst-class:: classref-property-setget
- |void| **set_write_mode**\ (\ value\: :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>`\ )
- :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` **get_write_mode**\ (\ )
The transfer mode to use when sending outgoing packet. Either text or binary.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_WebRTCDataChannel_method_close:
.. rst-class:: classref-method
|void| **close**\ (\ ) :ref:`🔗<class_WebRTCDataChannel_method_close>`
Closes this data channel, notifying the other peer.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_buffered_amount:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_buffered_amount**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_buffered_amount>`
Returns the number of bytes currently queued to be sent over this channel.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_id:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_id**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_id>`
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).
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_label:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_label**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_label>`
Returns the label assigned to this channel during creation.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_max_packet_life_time:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_max_packet_life_time**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_max_packet_life_time>`
Returns the ``maxPacketLifeTime`` value assigned to this channel during creation.
Will be ``65535`` if not specified.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_max_retransmits:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_max_retransmits**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_max_retransmits>`
Returns the ``maxRetransmits`` value assigned to this channel during creation.
Will be ``65535`` if not specified.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_protocol:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_protocol**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_protocol>`
Returns the sub-protocol assigned to this channel during creation. An empty string if not specified.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_get_ready_state:
.. rst-class:: classref-method
:ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **get_ready_state**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_get_ready_state>`
Returns the current state of this channel.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_is_negotiated:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_negotiated**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_is_negotiated>`
Returns ``true`` if this channel was created with out-of-band configuration.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_is_ordered:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_ordered**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_is_ordered>`
Returns ``true`` if this channel was created with ordering enabled (default).
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_poll:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **poll**\ (\ ) :ref:`🔗<class_WebRTCDataChannel_method_poll>`
Reserved, but not used for now.
.. rst-class:: classref-item-separator
----
.. _class_WebRTCDataChannel_method_was_string_packet:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **was_string_packet**\ (\ ) |const| :ref:`🔗<class_WebRTCDataChannel_method_was_string_packet>`
Returns ``true`` if the last received packet was transferred as text. See :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>`.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`