setRemoteDescription method

JSPromise<JSAny?> setRemoteDescription(
  1. RTCSessionDescriptionInit description, [
  2. VoidFunction successCallback,
  3. RTCPeerConnectionErrorCallback failureCallback
])

The setRemoteDescription() method of the RTCPeerConnection interface sets the specified session description as the remote peer's current offer or answer. The description specifies the properties of the remote end of the connection, including the media format. The method takes a single parameter—the session description—and it returns a Promise which is fulfilled once the description has been changed, asynchronously.

This is typically called after receiving an offer or answer from another peer over the signaling server. Keep in mind that if setRemoteDescription() is called while a connection is already in place, it means renegotiation is underway (possibly to adapt to changing network conditions).

Because descriptions will be exchanged until the two peers agree on a configuration, the description submitted by calling setRemoteDescription() does not immediately take effect. Instead, the current connection configuration remains in place until negotiation is complete. Only then does the agreed-upon configuration take effect.

Implementation

external JSPromise<JSAny?> setRemoteDescription(
  RTCSessionDescriptionInit description, [
  VoidFunction successCallback,
  RTCPeerConnectionErrorCallback failureCallback,
]);