RTCDataChannelEvent.channel

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

읽기 속성인 RTCDataChannelEvent.channel는 RTCDataChannel와 관련이 있는 이벤트를 반환합니다.

Syntax

 var channel = RTCDataChannelEvent.channel;

RTCDataChannel 객체는 RTCPeerConnection을 원격 피어와 연결해주는 데이터 채널을 알려줍니다.

예시

datachannel 이벤트 핸들러 안 코드의 첫 줄에서 이벤트 객체의 채널을 가져오고, 이를 데이터 트래픽을 관리하는 코드에 사용 될 수 있도록 지역 변수로 저장합니다.

pc.ondatachannel = function(event) {
  inboundDataChannel = event.channel;
  inboundDataChannel.onmessage = handleIncomingMessage;
  inboundDataChannel.onopen = handleChannelOpen;
  inboundDataChannel.onclose = handleChannelClose;
}

명세

명세 상태 코멘트
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCDataChannelEvent.channel' in that specification.
Candidate Recommendation Initial specification.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
channelChrome Full support YesEdge ? Firefox Full support 22IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support 28Firefox Android Full support 22Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also