The RTCDataChannelEvent()
constructor creates a new RTCDataChannelEvent
object.
Note: You will rarely if ever construct an RTCDataChannelEvent
by hand; these events are normally created and sent by the WebRTC layer itself.
The RTCDataChannelEvent()
constructor creates a new RTCDataChannelEvent
object.
Note: You will rarely if ever construct an RTCDataChannelEvent
by hand; these events are normally created and sent by the WebRTC layer itself.
new RTCDataChannelEvent(type, options)
type
A string with the name of the event. It is case-sensitive and browsers always set it to datachannel
.
options
An object that, in addition of the properties defined in Event()
, can have the following properties:
channel
A RTCDataChannel
, representing the data channel being associated with the event.
A new RTCDataChannelEvent
object configured as specified.
In this example, a new datachannel
event is created. dc
is a data channel which already exists.
const event = new RTCDataChannelEvent("datachannel", { channel: dc });
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
RTCDataChannelEvent |
56 | 79 | 22 | No | 43 | 11 | 56 | 56 | 24 | 43 | 11 | 7.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannelEvent/RTCDataChannelEvent