class_webrtcdatachannel.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/webrtc/doc_classes/WebRTCDataChannel.xml.
  6. .. _class_WebRTCDataChannel:
  7. WebRTCDataChannel
  8. =================
  9. **Inherits:** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`WebRTCDataChannelExtension<class_WebRTCDataChannelExtension>`
  11. Properties
  12. ----------
  13. +----------------------------------------------------+----------------------------------------------------------------+-------+
  14. | :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` | :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>` | ``1`` |
  15. +----------------------------------------------------+----------------------------------------------------------------+-------+
  16. Methods
  17. -------
  18. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`close<class_WebRTCDataChannel_method_close>` **(** **)** |
  20. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_buffered_amount<class_WebRTCDataChannel_method_get_buffered_amount>` **(** **)** |const| |
  22. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_id<class_WebRTCDataChannel_method_get_id>` **(** **)** |const| |
  24. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  25. | :ref:`String<class_String>` | :ref:`get_label<class_WebRTCDataChannel_method_get_label>` **(** **)** |const| |
  26. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_max_packet_life_time<class_WebRTCDataChannel_method_get_max_packet_life_time>` **(** **)** |const| |
  28. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_max_retransmits<class_WebRTCDataChannel_method_get_max_retransmits>` **(** **)** |const| |
  30. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`get_protocol<class_WebRTCDataChannel_method_get_protocol>` **(** **)** |const| |
  32. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  33. | :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` | :ref:`get_ready_state<class_WebRTCDataChannel_method_get_ready_state>` **(** **)** |const| |
  34. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`is_negotiated<class_WebRTCDataChannel_method_is_negotiated>` **(** **)** |const| |
  36. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_ordered<class_WebRTCDataChannel_method_is_ordered>` **(** **)** |const| |
  38. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`poll<class_WebRTCDataChannel_method_poll>` **(** **)** |
  40. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`was_string_packet<class_WebRTCDataChannel_method_was_string_packet>` **(** **)** |const| |
  42. +----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+
  43. Enumerations
  44. ------------
  45. .. _enum_WebRTCDataChannel_WriteMode:
  46. .. _class_WebRTCDataChannel_constant_WRITE_MODE_TEXT:
  47. .. _class_WebRTCDataChannel_constant_WRITE_MODE_BINARY:
  48. enum **WriteMode**:
  49. - **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.
  50. - **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.
  51. ----
  52. .. _enum_WebRTCDataChannel_ChannelState:
  53. .. _class_WebRTCDataChannel_constant_STATE_CONNECTING:
  54. .. _class_WebRTCDataChannel_constant_STATE_OPEN:
  55. .. _class_WebRTCDataChannel_constant_STATE_CLOSING:
  56. .. _class_WebRTCDataChannel_constant_STATE_CLOSED:
  57. enum **ChannelState**:
  58. - **STATE_CONNECTING** = **0** --- The channel was created, but it's still trying to connect.
  59. - **STATE_OPEN** = **1** --- The channel is currently open, and data can flow over it.
  60. - **STATE_CLOSING** = **2** --- The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.
  61. - **STATE_CLOSED** = **3** --- The channel was closed, or connection failed.
  62. Property Descriptions
  63. ---------------------
  64. .. _class_WebRTCDataChannel_property_write_mode:
  65. - :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` **write_mode**
  66. +-----------+-----------------------+
  67. | *Default* | ``1`` |
  68. +-----------+-----------------------+
  69. | *Setter* | set_write_mode(value) |
  70. +-----------+-----------------------+
  71. | *Getter* | get_write_mode() |
  72. +-----------+-----------------------+
  73. The transfer mode to use when sending outgoing packet. Either text or binary.
  74. Method Descriptions
  75. -------------------
  76. .. _class_WebRTCDataChannel_method_close:
  77. - void **close** **(** **)**
  78. Closes this data channel, notifying the other peer.
  79. ----
  80. .. _class_WebRTCDataChannel_method_get_buffered_amount:
  81. - :ref:`int<class_int>` **get_buffered_amount** **(** **)** |const|
  82. Returns the number of bytes currently queued to be sent over this channel.
  83. ----
  84. .. _class_WebRTCDataChannel_method_get_id:
  85. - :ref:`int<class_int>` **get_id** **(** **)** |const|
  86. Returns the id assigned to this channel during creation (or auto-assigned during negotiation).
  87. 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).
  88. ----
  89. .. _class_WebRTCDataChannel_method_get_label:
  90. - :ref:`String<class_String>` **get_label** **(** **)** |const|
  91. Returns the label assigned to this channel during creation.
  92. ----
  93. .. _class_WebRTCDataChannel_method_get_max_packet_life_time:
  94. - :ref:`int<class_int>` **get_max_packet_life_time** **(** **)** |const|
  95. Returns the ``maxPacketLifeTime`` value assigned to this channel during creation.
  96. Will be ``65535`` if not specified.
  97. ----
  98. .. _class_WebRTCDataChannel_method_get_max_retransmits:
  99. - :ref:`int<class_int>` **get_max_retransmits** **(** **)** |const|
  100. Returns the ``maxRetransmits`` value assigned to this channel during creation.
  101. Will be ``65535`` if not specified.
  102. ----
  103. .. _class_WebRTCDataChannel_method_get_protocol:
  104. - :ref:`String<class_String>` **get_protocol** **(** **)** |const|
  105. Returns the sub-protocol assigned to this channel during creation. An empty string if not specified.
  106. ----
  107. .. _class_WebRTCDataChannel_method_get_ready_state:
  108. - :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **get_ready_state** **(** **)** |const|
  109. Returns the current state of this channel, see :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>`.
  110. ----
  111. .. _class_WebRTCDataChannel_method_is_negotiated:
  112. - :ref:`bool<class_bool>` **is_negotiated** **(** **)** |const|
  113. Returns ``true`` if this channel was created with out-of-band configuration.
  114. ----
  115. .. _class_WebRTCDataChannel_method_is_ordered:
  116. - :ref:`bool<class_bool>` **is_ordered** **(** **)** |const|
  117. Returns ``true`` if this channel was created with ordering enabled (default).
  118. ----
  119. .. _class_WebRTCDataChannel_method_poll:
  120. - :ref:`Error<enum_@GlobalScope_Error>` **poll** **(** **)**
  121. Reserved, but not used for now.
  122. ----
  123. .. _class_WebRTCDataChannel_method_was_string_packet:
  124. - :ref:`bool<class_bool>` **was_string_packet** **(** **)** |const|
  125. Returns ``true`` if the last received packet was transferred as text. See :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>`.
  126. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  127. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  128. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  129. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  130. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  131. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`