W3cubDocs

/DOM

RTCPeerConnection.getConfiguration

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The RTCPeerConnection.getConfiguration() method returns a RTCConfiguration object which indicates the current configuration of the RTCPeerConnection on which the method is called.

The configuration includes a list of the ICE servers used by the connection, information about transport policies, and identity information.

Syntax

configuration = RTCPeerConnection.getConfiguration();

Parameters

This method takes no input parameters.

Return value

An RTCConfiguration object describing the RTCPeerConnection's current configuration.

Example

This example adds a new certificate to an active connection if it doesn't already have one in use.

let configuration = myPeerConnection.getConfiguration();

if ((configuration.certificates != undefined) && (!configuration.certificates.length)) {
   RTCPeerConnection.generateCertificate({
      name: 'RSASSA-PKCS1-v1_5',
      hash: 'SHA-256',
      modulusLength: 2048,
      publicExponent: new Uint8Array([1, 0, 1])
  }).then(function(cert) {
    configuration.certificates = [cert];
    myPeerConnection.setConfiguration(configuration);
  });
}

This example fetches the current configuration of the RTCPeerConnection, then looks to see if it has any certificates set by examining whether or not (a) the configuration has a value for certificates, and (b) whether its length is zero.

If it's determined that there are no certificates in place, RTCPeerConnection.generateCertificate() is called to create a new certificate; we provide a fulfillment handler which adds a new array containing the one newly-created certificate to the current configuration and passes it to setConfiguration() to add the certificate to the connection.

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browser
The definition of 'getConfiguration()' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support CompatUnknown 48 (48) ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support CompatUnknown CompatUnknown 48.0 (48) ? ? ? ? CompatUnknown

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/getConfiguration