RTCDataChannelEvent
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
RTCDataChannelEvent
インターフェイスは、特定の RTCPeerConnection
に関連するイベントを表します。
コンストラクター
RTCDataChannelEvent()
-
新しい
RTCDataChannelEvent
を作成します。
インスタンスプロパティ
Event
のプロパティを継承しています。
channel
読取専用-
このイベントに関連付けられた
RTCDataChannel
を返します。
例
この例では、 datachannel
イベントハンドラーを設定して、データチャンネルの参照を保存し、監視する必要があるイベントのハンドラーを設定しています。 channel
プロパティは、他にもピアへの接続を表す RTCDataChannel
を提供しています。
js
pc.ondatachannel = (event) => {
inboundDataChannel = event.channel;
inboundDataChannel.onmessage = handleIncomingMessage;
inboundDataChannel.onopen = handleChannelOpen;
inboundDataChannel.onclose = handleChannelClose;
};
データチャンネルを使用する、より完全な別の例は、単純な RTCDataChannel の例を参照してください。
仕様書
Specification |
---|
WebRTC: Real-Time Communication in Browsers # rtcdatachannelevent |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
RTCDataChannelEvent | ||||||||||||
RTCDataChannelEvent() constructor | ||||||||||||
channel |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- WebRTC
RTCDataChannel
- 単純な RTCDataChannel の例
RTCPeerConnection
(datachannel
イベントのターゲットインターフェイス)