RTCDataChannelEvent
RTCDataChannelEvent インターフェイスは、特定の RTCPeerConnection に関連するイベントを表します。
コンストラクター
RTCDataChannelEvent()(en-US)-
新しい
RTCDataChannelEventを作成します。
インスタンスプロパティ
Event のプロパティを継承しています。。
channel(en-US) 読取専用-
このイベントに関連付けられた
RTCDataChannelを返します。
例
この例では、 datachannel イベントハンドラーを設定して、データチャンネルの参照を保存し、監視する必要があるイベントのハンドラーを設定しています。 channel (en-US) プロパティは、他にもピアへの接続を表す RTCDataChannel を提供しています。
js
pc.ondatachannel = (event) => {
inboundDataChannel = event.channel;
inboundDataChannel.onmessage = handleIncomingMessage;
inboundDataChannel.onopen = handleChannelOpen;
inboundDataChannel.onclose = handleChannelClose;
}
データチャンネルを使用する、より完全な別の例は、単純な RTCDataChannel の例 (en-US)を参照してください。
仕様書
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers # rtcdatachannelevent |
ブラウザーの互換性
BCD tables only load in the browser
関連情報
- WebRTC
RTCDataChannel- 単純な RTCDataChannel の例 (en-US)
RTCPeerConnection(datachannel(en-US) イベントのターゲットインターフェイス)