| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since September 2017.
The RTCSessionDescription interface describes one end of a connectionor potential connectionand how it's configured. Each RTCSessionDescription consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session.
The process of negotiating a connection between two peers involves exchanging RTCSessionDescription objects back and forth, with each description suggesting one combination of connection configuration options that the sender of the description supports. Once the two peers agree upon a configuration for the connection, negotiation is complete.
RTCSessionDescription() Creates a new RTCSessionDescription by specifying the type and sdp. All methods that accept RTCSessionDescription objects also accept objects with the same properties, so you can use a plain object instead of creating an RTCSessionDescription instance.
The RTCSessionDescription interface doesn't inherit any properties.
RTCSessionDescription.type Read onlyAn enum describing the session description's type.
RTCSessionDescription.sdp Read onlyA string containing the SDP describing the session.
The RTCSessionDescription interface doesn't inherit any methods.
RTCSessionDescription.toJSON()Returns a JSON description of the object. The values of both properties, type and sdp, are contained in the generated JSON.
signalingChannel.onmessage = (evt) => {
if (!pc) start(false);
const message = JSON.parse(evt.data);
if (message.type && message.sdp) {
pc.setRemoteDescription(
new RTCSessionDescription(message),
() => {
// if we received an offer, we need to answer
if (pc.remoteDescription.type === "offer") {
pc.createAnswer(localDescCreated, logError);
}
},
logError,
);
} else {
pc.addIceCandidate(
new RTCIceCandidate(message.candidate),
() => {},
logError,
);
}
};
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers # rtcsessiondescription-class |
This page was last modified on Sep 2, 2026 by MDN contributors.
RTCSessionDescriptionMediaDevices.getUserMedia()Navigator.mediaDevicesRTCAudioSourceStatsRTCCertificateRTCCodecStatsRTCDTMFSenderRTCDTMFToneChangeEventRTCDataChannelRTCDataChannelEventRTCDataChannelStatsRTCDtlsTransportRTCEncodedAudioFrameRTCEncodedVideoFrameRTCErrorEventRTCIceCandidateRTCIceCandidatePairRTCIceCandidatePairStatsRTCIceCandidateStatsRTCIceParametersRTCIceTransportRTCInboundRtpStreamStatsRTCOutboundRtpStreamStatsRTCPeerConnectionRTCPeerConnectionIceErrorEventRTCPeerConnectionIceEventRTCPeerConnectionStatsRTCRemoteInboundRtpStreamStatsRTCRemoteOutboundRtpStreamStatsRTCRtpReceiverRTCRtpReceiver.transformRTCRtpScriptTransformRTCRtpScriptTransformerRTCRtpSenderRTCRtpSender.transformRTCRtpTransceiverRTCSctpTransportRTCStatsReportRTCTrackEventRTCTransformEventRTCVideoSourceStatsYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |