class_webrtcpeerconnection.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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/WebRTCPeerConnection.xml.
  6. .. _class_WebRTCPeerConnection:
  7. WebRTCPeerConnection
  8. ====================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`WebRTCPeerConnectionExtension<class_WebRTCPeerConnectionExtension>`
  11. Interface to a WebRTC peer connection.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. A WebRTC connection between the local computer and a remote peer. Provides an interface to connect, maintain and monitor the connection.
  16. Setting up a WebRTC connection between two peers may not seem a trivial task, but it can be broken down into 3 main steps:
  17. - The peer that wants to initiate the connection (``A`` from now on) creates an offer and send it to the other peer (``B`` from now on).
  18. - ``B`` receives the offer, generate and answer, and sends it to ``A``).
  19. - ``A`` and ``B`` then generates and exchange ICE candidates with each other.
  20. After these steps, the connection should become connected. Keep on reading or look into the tutorial for more information.
  21. .. rst-class:: classref-reftable-group
  22. Methods
  23. -------
  24. .. table::
  25. :widths: auto
  26. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`add_ice_candidate<class_WebRTCPeerConnection_method_add_ice_candidate>`\ (\ media\: :ref:`String<class_String>`, index\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) |
  28. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | |void| | :ref:`close<class_WebRTCPeerConnection_method_close>`\ (\ ) |
  30. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`WebRTCDataChannel<class_WebRTCDataChannel>` | :ref:`create_data_channel<class_WebRTCPeerConnection_method_create_data_channel>`\ (\ label\: :ref:`String<class_String>`, options\: :ref:`Dictionary<class_Dictionary>` = {}\ ) |
  32. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`create_offer<class_WebRTCPeerConnection_method_create_offer>`\ (\ ) |
  34. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` | :ref:`get_connection_state<class_WebRTCPeerConnection_method_get_connection_state>`\ (\ ) |const| |
  36. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` | :ref:`get_gathering_state<class_WebRTCPeerConnection_method_get_gathering_state>`\ (\ ) |const| |
  38. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` | :ref:`get_signaling_state<class_WebRTCPeerConnection_method_get_signaling_state>`\ (\ ) |const| |
  40. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`initialize<class_WebRTCPeerConnection_method_initialize>`\ (\ configuration\: :ref:`Dictionary<class_Dictionary>` = {}\ ) |
  42. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`poll<class_WebRTCPeerConnection_method_poll>`\ (\ ) |
  44. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`set_default_extension<class_WebRTCPeerConnection_method_set_default_extension>`\ (\ extension_class\: :ref:`StringName<class_StringName>`\ ) |static| |
  46. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`set_local_description<class_WebRTCPeerConnection_method_set_local_description>`\ (\ type\: :ref:`String<class_String>`, sdp\: :ref:`String<class_String>`\ ) |
  48. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`set_remote_description<class_WebRTCPeerConnection_method_set_remote_description>`\ (\ type\: :ref:`String<class_String>`, sdp\: :ref:`String<class_String>`\ ) |
  50. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Signals
  55. -------
  56. .. _class_WebRTCPeerConnection_signal_data_channel_received:
  57. .. rst-class:: classref-signal
  58. **data_channel_received**\ (\ channel\: :ref:`WebRTCDataChannel<class_WebRTCDataChannel>`\ ) :ref:`🔗<class_WebRTCPeerConnection_signal_data_channel_received>`
  59. Emitted when a new in-band channel is received, i.e. when the channel was created with ``negotiated: false`` (default).
  60. The object will be an instance of :ref:`WebRTCDataChannel<class_WebRTCDataChannel>`. You must keep a reference of it or it will be closed automatically. See :ref:`create_data_channel<class_WebRTCPeerConnection_method_create_data_channel>`.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_WebRTCPeerConnection_signal_ice_candidate_created:
  64. .. rst-class:: classref-signal
  65. **ice_candidate_created**\ (\ media\: :ref:`String<class_String>`, index\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_WebRTCPeerConnection_signal_ice_candidate_created>`
  66. Emitted when a new ICE candidate has been created. The three parameters are meant to be passed to the remote peer over the signaling server.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_WebRTCPeerConnection_signal_session_description_created:
  70. .. rst-class:: classref-signal
  71. **session_description_created**\ (\ type\: :ref:`String<class_String>`, sdp\: :ref:`String<class_String>`\ ) :ref:`🔗<class_WebRTCPeerConnection_signal_session_description_created>`
  72. Emitted after a successful call to :ref:`create_offer<class_WebRTCPeerConnection_method_create_offer>` or :ref:`set_remote_description<class_WebRTCPeerConnection_method_set_remote_description>` (when it generates an answer). The parameters are meant to be passed to :ref:`set_local_description<class_WebRTCPeerConnection_method_set_local_description>` on this object, and sent to the remote peer over the signaling server.
  73. .. rst-class:: classref-section-separator
  74. ----
  75. .. rst-class:: classref-descriptions-group
  76. Enumerations
  77. ------------
  78. .. _enum_WebRTCPeerConnection_ConnectionState:
  79. .. rst-class:: classref-enumeration
  80. enum **ConnectionState**: :ref:`🔗<enum_WebRTCPeerConnection_ConnectionState>`
  81. .. _class_WebRTCPeerConnection_constant_STATE_NEW:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_NEW** = ``0``
  84. The connection is new, data channels and an offer can be created in this state.
  85. .. _class_WebRTCPeerConnection_constant_STATE_CONNECTING:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_CONNECTING** = ``1``
  88. The peer is connecting, ICE is in progress, none of the transports has failed.
  89. .. _class_WebRTCPeerConnection_constant_STATE_CONNECTED:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_CONNECTED** = ``2``
  92. The peer is connected, all ICE transports are connected.
  93. .. _class_WebRTCPeerConnection_constant_STATE_DISCONNECTED:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_DISCONNECTED** = ``3``
  96. At least one ICE transport is disconnected.
  97. .. _class_WebRTCPeerConnection_constant_STATE_FAILED:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_FAILED** = ``4``
  100. One or more of the ICE transports failed.
  101. .. _class_WebRTCPeerConnection_constant_STATE_CLOSED:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **STATE_CLOSED** = ``5``
  104. The peer connection is closed (after calling :ref:`close<class_WebRTCPeerConnection_method_close>` for example).
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _enum_WebRTCPeerConnection_GatheringState:
  108. .. rst-class:: classref-enumeration
  109. enum **GatheringState**: :ref:`🔗<enum_WebRTCPeerConnection_GatheringState>`
  110. .. _class_WebRTCPeerConnection_constant_GATHERING_STATE_NEW:
  111. .. rst-class:: classref-enumeration-constant
  112. :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` **GATHERING_STATE_NEW** = ``0``
  113. The peer connection was just created and hasn't done any networking yet.
  114. .. _class_WebRTCPeerConnection_constant_GATHERING_STATE_GATHERING:
  115. .. rst-class:: classref-enumeration-constant
  116. :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` **GATHERING_STATE_GATHERING** = ``1``
  117. The ICE agent is in the process of gathering candidates for the connection.
  118. .. _class_WebRTCPeerConnection_constant_GATHERING_STATE_COMPLETE:
  119. .. rst-class:: classref-enumeration-constant
  120. :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` **GATHERING_STATE_COMPLETE** = ``2``
  121. The ICE agent has finished gathering candidates. If something happens that requires collecting new candidates, such as a new interface being added or the addition of a new ICE server, the state will revert to gathering to gather those candidates.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _enum_WebRTCPeerConnection_SignalingState:
  125. .. rst-class:: classref-enumeration
  126. enum **SignalingState**: :ref:`🔗<enum_WebRTCPeerConnection_SignalingState>`
  127. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_STABLE:
  128. .. rst-class:: classref-enumeration-constant
  129. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_STABLE** = ``0``
  130. There is no ongoing exchange of offer and answer underway. This may mean that the **WebRTCPeerConnection** is new (:ref:`STATE_NEW<class_WebRTCPeerConnection_constant_STATE_NEW>`) or that negotiation is complete and a connection has been established (:ref:`STATE_CONNECTED<class_WebRTCPeerConnection_constant_STATE_CONNECTED>`).
  131. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_HAVE_LOCAL_OFFER:
  132. .. rst-class:: classref-enumeration-constant
  133. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_HAVE_LOCAL_OFFER** = ``1``
  134. The local peer has called :ref:`set_local_description<class_WebRTCPeerConnection_method_set_local_description>`, passing in SDP representing an offer (usually created by calling :ref:`create_offer<class_WebRTCPeerConnection_method_create_offer>`), and the offer has been applied successfully.
  135. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_HAVE_REMOTE_OFFER:
  136. .. rst-class:: classref-enumeration-constant
  137. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_HAVE_REMOTE_OFFER** = ``2``
  138. The remote peer has created an offer and used the signaling server to deliver it to the local peer, which has set the offer as the remote description by calling :ref:`set_remote_description<class_WebRTCPeerConnection_method_set_remote_description>`.
  139. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_HAVE_LOCAL_PRANSWER:
  140. .. rst-class:: classref-enumeration-constant
  141. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_HAVE_LOCAL_PRANSWER** = ``3``
  142. The offer sent by the remote peer has been applied and an answer has been created and applied by calling :ref:`set_local_description<class_WebRTCPeerConnection_method_set_local_description>`. This provisional answer describes the supported media formats and so forth, but may not have a complete set of ICE candidates included. Further candidates will be delivered separately later.
  143. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_HAVE_REMOTE_PRANSWER:
  144. .. rst-class:: classref-enumeration-constant
  145. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_HAVE_REMOTE_PRANSWER** = ``4``
  146. A provisional answer has been received and successfully applied in response to an offer previously sent and established by calling :ref:`set_local_description<class_WebRTCPeerConnection_method_set_local_description>`.
  147. .. _class_WebRTCPeerConnection_constant_SIGNALING_STATE_CLOSED:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **SIGNALING_STATE_CLOSED** = ``5``
  150. The **WebRTCPeerConnection** has been closed.
  151. .. rst-class:: classref-section-separator
  152. ----
  153. .. rst-class:: classref-descriptions-group
  154. Method Descriptions
  155. -------------------
  156. .. _class_WebRTCPeerConnection_method_add_ice_candidate:
  157. .. rst-class:: classref-method
  158. :ref:`Error<enum_@GlobalScope_Error>` **add_ice_candidate**\ (\ media\: :ref:`String<class_String>`, index\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_WebRTCPeerConnection_method_add_ice_candidate>`
  159. Add an ice candidate generated by a remote peer (and received over the signaling server). See :ref:`ice_candidate_created<class_WebRTCPeerConnection_signal_ice_candidate_created>`.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_WebRTCPeerConnection_method_close:
  163. .. rst-class:: classref-method
  164. |void| **close**\ (\ ) :ref:`🔗<class_WebRTCPeerConnection_method_close>`
  165. Close the peer connection and all data channels associated with it.
  166. \ **Note:** You cannot reuse this object for a new connection unless you call :ref:`initialize<class_WebRTCPeerConnection_method_initialize>`.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _class_WebRTCPeerConnection_method_create_data_channel:
  170. .. rst-class:: classref-method
  171. :ref:`WebRTCDataChannel<class_WebRTCDataChannel>` **create_data_channel**\ (\ label\: :ref:`String<class_String>`, options\: :ref:`Dictionary<class_Dictionary>` = {}\ ) :ref:`🔗<class_WebRTCPeerConnection_method_create_data_channel>`
  172. Returns a new :ref:`WebRTCDataChannel<class_WebRTCDataChannel>` (or ``null`` on failure) with given ``label`` and optionally configured via the ``options`` dictionary. This method can only be called when the connection is in state :ref:`STATE_NEW<class_WebRTCPeerConnection_constant_STATE_NEW>`.
  173. There are two ways to create a working data channel: either call :ref:`create_data_channel<class_WebRTCPeerConnection_method_create_data_channel>` on only one of the peer and listen to :ref:`data_channel_received<class_WebRTCPeerConnection_signal_data_channel_received>` on the other, or call :ref:`create_data_channel<class_WebRTCPeerConnection_method_create_data_channel>` on both peers, with the same values, and the ``"negotiated"`` option set to ``true``.
  174. Valid ``options`` are:
  175. ::
  176. {
  177. "negotiated": true, # When set to true (default off), means the channel is negotiated out of band. "id" must be set too. "data_channel_received" will not be called.
  178. "id": 1, # When "negotiated" is true this value must also be set to the same value on both peer.
  179. # Only one of maxRetransmits and maxPacketLifeTime can be specified, not both. They make the channel unreliable (but also better at real time).
  180. "maxRetransmits": 1, # Specify the maximum number of attempt the peer will make to retransmits packets if they are not acknowledged.
  181. "maxPacketLifeTime": 100, # Specify the maximum amount of time before giving up retransmitions of unacknowledged packets (in milliseconds).
  182. "ordered": true, # When in unreliable mode (i.e. either "maxRetransmits" or "maxPacketLifetime" is set), "ordered" (true by default) specify if packet ordering is to be enforced.
  183. "protocol": "my-custom-protocol", # A custom sub-protocol string for this channel.
  184. }
  185. \ **Note:** You must keep a reference to channels created this way, or it will be closed.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_WebRTCPeerConnection_method_create_offer:
  189. .. rst-class:: classref-method
  190. :ref:`Error<enum_@GlobalScope_Error>` **create_offer**\ (\ ) :ref:`🔗<class_WebRTCPeerConnection_method_create_offer>`
  191. Creates a new SDP offer to start a WebRTC connection with a remote peer. At least one :ref:`WebRTCDataChannel<class_WebRTCDataChannel>` must have been created before calling this method.
  192. If this functions returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`, :ref:`session_description_created<class_WebRTCPeerConnection_signal_session_description_created>` will be called when the session is ready to be sent.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_WebRTCPeerConnection_method_get_connection_state:
  196. .. rst-class:: classref-method
  197. :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>` **get_connection_state**\ (\ ) |const| :ref:`🔗<class_WebRTCPeerConnection_method_get_connection_state>`
  198. Returns the connection state. See :ref:`ConnectionState<enum_WebRTCPeerConnection_ConnectionState>`.
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_WebRTCPeerConnection_method_get_gathering_state:
  202. .. rst-class:: classref-method
  203. :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` **get_gathering_state**\ (\ ) |const| :ref:`🔗<class_WebRTCPeerConnection_method_get_gathering_state>`
  204. Returns the ICE :ref:`GatheringState<enum_WebRTCPeerConnection_GatheringState>` of the connection. This lets you detect, for example, when collection of ICE candidates has finished.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _class_WebRTCPeerConnection_method_get_signaling_state:
  208. .. rst-class:: classref-method
  209. :ref:`SignalingState<enum_WebRTCPeerConnection_SignalingState>` **get_signaling_state**\ (\ ) |const| :ref:`🔗<class_WebRTCPeerConnection_method_get_signaling_state>`
  210. Returns the signaling state on the local end of the connection while connecting or reconnecting to another peer.
  211. .. rst-class:: classref-item-separator
  212. ----
  213. .. _class_WebRTCPeerConnection_method_initialize:
  214. .. rst-class:: classref-method
  215. :ref:`Error<enum_@GlobalScope_Error>` **initialize**\ (\ configuration\: :ref:`Dictionary<class_Dictionary>` = {}\ ) :ref:`🔗<class_WebRTCPeerConnection_method_initialize>`
  216. Re-initialize this peer connection, closing any previously active connection, and going back to state :ref:`STATE_NEW<class_WebRTCPeerConnection_constant_STATE_NEW>`. A dictionary of ``configuration`` options can be passed to configure the peer connection.
  217. Valid ``configuration`` options are:
  218. ::
  219. {
  220. "iceServers": [
  221. {
  222. "urls": [ "stun:stun.example.com:3478" ], # One or more STUN servers.
  223. },
  224. {
  225. "urls": [ "turn:turn.example.com:3478" ], # One or more TURN servers.
  226. "username": "a_username", # Optional username for the TURN server.
  227. "credential": "a_password", # Optional password for the TURN server.
  228. }
  229. ]
  230. }
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_WebRTCPeerConnection_method_poll:
  234. .. rst-class:: classref-method
  235. :ref:`Error<enum_@GlobalScope_Error>` **poll**\ (\ ) :ref:`🔗<class_WebRTCPeerConnection_method_poll>`
  236. Call this method frequently (e.g. in :ref:`Node._process<class_Node_private_method__process>` or :ref:`Node._physics_process<class_Node_private_method__physics_process>`) to properly receive signals.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_WebRTCPeerConnection_method_set_default_extension:
  240. .. rst-class:: classref-method
  241. |void| **set_default_extension**\ (\ extension_class\: :ref:`StringName<class_StringName>`\ ) |static| :ref:`🔗<class_WebRTCPeerConnection_method_set_default_extension>`
  242. Sets the ``extension_class`` as the default :ref:`WebRTCPeerConnectionExtension<class_WebRTCPeerConnectionExtension>` returned when creating a new **WebRTCPeerConnection**.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_WebRTCPeerConnection_method_set_local_description:
  246. .. rst-class:: classref-method
  247. :ref:`Error<enum_@GlobalScope_Error>` **set_local_description**\ (\ type\: :ref:`String<class_String>`, sdp\: :ref:`String<class_String>`\ ) :ref:`🔗<class_WebRTCPeerConnection_method_set_local_description>`
  248. Sets the SDP description of the local peer. This should be called in response to :ref:`session_description_created<class_WebRTCPeerConnection_signal_session_description_created>`.
  249. After calling this function the peer will start emitting :ref:`ice_candidate_created<class_WebRTCPeerConnection_signal_ice_candidate_created>` (unless an :ref:`Error<enum_@GlobalScope_Error>` different from :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` is returned).
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_WebRTCPeerConnection_method_set_remote_description:
  253. .. rst-class:: classref-method
  254. :ref:`Error<enum_@GlobalScope_Error>` **set_remote_description**\ (\ type\: :ref:`String<class_String>`, sdp\: :ref:`String<class_String>`\ ) :ref:`🔗<class_WebRTCPeerConnection_method_set_remote_description>`
  255. Sets the SDP description of the remote peer. This should be called with the values generated by a remote peer and received over the signaling server.
  256. If ``type`` is ``"offer"`` the peer will emit :ref:`session_description_created<class_WebRTCPeerConnection_signal_session_description_created>` with the appropriate answer.
  257. If ``type`` is ``"answer"`` the peer will start emitting :ref:`ice_candidate_created<class_WebRTCPeerConnection_signal_ice_candidate_created>`.
  258. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  259. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  260. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  261. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  262. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  263. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  264. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  265. .. |void| replace:: :abbr:`void (No return value.)`