class_webrtcdatachannel.rst 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the WebRTCDataChannel.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_WebRTCDataChannel:
  6. WebRTCDataChannel
  7. =================
  8. **Inherits:** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`WebRTCDataChannelGDNative<class_WebRTCDataChannelGDNative>`
  10. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Properties
  14. ----------
  15. +----------------------------------------------------+----------------------------------------------------------------+---+
  16. | :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` | :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>` | 1 |
  17. +----------------------------------------------------+----------------------------------------------------------------+---+
  18. Methods
  19. -------
  20. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`close<class_WebRTCDataChannel_method_close>` **(** **)** |
  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. .. _enum_WebRTCDataChannel_ChannelState:
  52. .. _class_WebRTCDataChannel_constant_STATE_CONNECTING:
  53. .. _class_WebRTCDataChannel_constant_STATE_OPEN:
  54. .. _class_WebRTCDataChannel_constant_STATE_CLOSING:
  55. .. _class_WebRTCDataChannel_constant_STATE_CLOSED:
  56. enum **ChannelState**:
  57. - **STATE_CONNECTING** = **0** --- The channel was created, but it's still trying to connect.
  58. - **STATE_OPEN** = **1** --- The channel is currently open, and data can flow over it.
  59. - **STATE_CLOSING** = **2** --- The channel is being closed, no new messages will be accepted, but those already in queue will be flushed.
  60. - **STATE_CLOSED** = **3** --- The channel was closed, or connection failed.
  61. Property Descriptions
  62. ---------------------
  63. .. _class_WebRTCDataChannel_property_write_mode:
  64. - :ref:`WriteMode<enum_WebRTCDataChannel_WriteMode>` **write_mode**
  65. +-----------+-----------------------+
  66. | *Default* | 1 |
  67. +-----------+-----------------------+
  68. | *Setter* | set_write_mode(value) |
  69. +-----------+-----------------------+
  70. | *Getter* | get_write_mode() |
  71. +-----------+-----------------------+
  72. The transfer mode to use when sending outgoing packet. Either text or binary.
  73. Method Descriptions
  74. -------------------
  75. .. _class_WebRTCDataChannel_method_close:
  76. - void **close** **(** **)**
  77. Closes this data channel, notifying the other peer.
  78. .. _class_WebRTCDataChannel_method_get_id:
  79. - :ref:`int<class_int>` **get_id** **(** **)** const
  80. Returns the id assigned to this channel during creation (or auto-assigned during negotiation).
  81. 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).
  82. .. _class_WebRTCDataChannel_method_get_label:
  83. - :ref:`String<class_String>` **get_label** **(** **)** const
  84. Returns the label assigned to this channel during creation.
  85. .. _class_WebRTCDataChannel_method_get_max_packet_life_time:
  86. - :ref:`int<class_int>` **get_max_packet_life_time** **(** **)** const
  87. Returns the ``maxPacketLifeTime`` value assigned to this channel during creation.
  88. Will be ``65535`` if not specified.
  89. .. _class_WebRTCDataChannel_method_get_max_retransmits:
  90. - :ref:`int<class_int>` **get_max_retransmits** **(** **)** const
  91. Returns the ``maxRetransmits`` value assigned to this channel during creation.
  92. Will be ``65535`` if not specified.
  93. .. _class_WebRTCDataChannel_method_get_protocol:
  94. - :ref:`String<class_String>` **get_protocol** **(** **)** const
  95. Returns the sub-protocol assigned to this channel during creation. An empty string if not specified.
  96. .. _class_WebRTCDataChannel_method_get_ready_state:
  97. - :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>` **get_ready_state** **(** **)** const
  98. Returns the current state of this channel, see :ref:`ChannelState<enum_WebRTCDataChannel_ChannelState>`.
  99. .. _class_WebRTCDataChannel_method_is_negotiated:
  100. - :ref:`bool<class_bool>` **is_negotiated** **(** **)** const
  101. Returns ``true`` if this channel was created with out-of-band configuration.
  102. .. _class_WebRTCDataChannel_method_is_ordered:
  103. - :ref:`bool<class_bool>` **is_ordered** **(** **)** const
  104. Returns ``true`` if this channel was created with ordering enabled (default).
  105. .. _class_WebRTCDataChannel_method_poll:
  106. - :ref:`Error<enum_@GlobalScope_Error>` **poll** **(** **)**
  107. Reserved, but not used for now.
  108. .. _class_WebRTCDataChannel_method_was_string_packet:
  109. - :ref:`bool<class_bool>` **was_string_packet** **(** **)** const
  110. Returns ``true`` if the last received packet was transferred as text. See :ref:`write_mode<class_WebRTCDataChannel_property_write_mode>`.