This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The RTCDataChannel.onopen property is an EventHandler which specifies a function to be called when the open event is fired; this is a simple Event which is sent when the data channel's underlying data transport—the link over which the RTCDataChannel's messages flow—is established or re-established.


RTCDataChannel.onopen = function;


A function which the browser will call to handle the open event. The function receives as its only input parameter the event itself, of type Event.


This example adds a new data channel to an existing RTCPeerConnection, myPeerConnection. It then establishes an open event handler which updates some user interface elements to prepare them for being used to send messages over the data channel.

let dc = myPeerConnection.createDataChannel("Message Channel");

dc.onopen = function(event) {
  let messageBox = document.getElementById("messageBox");
  let sendButton = document.getElementById("sendButton");

  messageBox.disabled = false;
  sendButton.disabled = false;


Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannel.onopen' in that specification.
Candidate Recommendation Initial specification.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Chrome Full support 56Edge Full support ≤79Firefox Full support YesIE No support NoOpera Full support 43Safari Full support YesWebView Android Full support 56Chrome Android Full support 56Firefox Android Full support YesOpera Android Full support 43Safari iOS Full support YesSamsung Internet Android Full support 6.0


Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also