Search completed in 1.39 seconds.
8 results for "ondatachannel":
RTCPeerConnection.ondatachannel - Web APIs
Web › API › RTCPeerConnection › ondatachannel
The RTCPeerConnection.ondatachannel property is an EventHandler which specifies a function which is called when the datachannel event occurs on an RTCPeerConnection. This event, of type RTCDataChannelEvent, is sent when an RTCDataChannel is added to the connection by the remote peer calling createDataChannel(). At the time this event is received, the RTCDataChannel it indicates may not yet actually be open. Be sure to wait for the "open" event to be fired on the new RTCDataChannel before using it. Syntax RTCPeerConnection.ondatachannel = function; Value Set this property to be a function you provide which receives as input a single parameter: an RTCDataChannelEvent which provides in its channel property the RTCDataChannel which has been created. ...
...icates may not yet actually be open. Be sure to wait for the "open" event to be fired on the new RTCDataChannel before using it. Syntax RTCPeerConnection.ondatachannel = function; Value Set this property to be a function you provide which receives as input a single parameter: an RTCDataChannelEvent which provides in its channel property the RTCDataChannel which has been created. Example pc.ondatachannel = function(ev) { console.log('Data channel is created!'); ev.channel.onopen = function() { console.log('Data channel is open and ready to be used.'); }; }; Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCPeerConnection.ondatachannel' in that specification. Candidate Recommendation ...
RTCPeerConnection: datachannel event - Web APIs
Web › API › RTCPeerConnection › datachannel event
is sent to an RTCPeerConnection instance when an RTCDataChannel has been added to the connection, as a result of the remote peer calling RTCPeerConnection.createDataChannel(). Note: This event is not dispatched when the local end of the connection creates the channel. Bubbles No Cancelable No Interface RTCDataChannelEvent Event handler property ondatachannel Examples This example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly added RTCDataChannel and by adding event handlers for the events that occur on that channel. pc.addEventListener("datachannel", ev => { receiveChannel = ev.channel; receiveChannel.onmessage = myHandleMessage; receiveChannel.onopen = myHandleOpen...
...nnel; receiveChannel.onmessage = myHandleMessage; receiveChannel.onopen = myHandleOpen; receiveChannel.onclose = myHandleClose; }, false); receiveChannel is set to the value of the event's channel property, which specifies the RTCDataChannel object representing the data channel linking the remote peer to the local one. ...
... receiveChannel.onopen = myHandleOpen; receiveChannel.onclose = myHandleClose; }, false); receiveChannel is set to the value of the event's channel property, which specifies the RTCDataChannel object representing the data channel linking the remote peer to the local one. This same code can also instead use the RTCPeerConnection interface's ondatachannel event handler property, like this: pc.ondatachannel = ev => { receiveChannel = ev.channel; receiveChannel.onmessage = myHandleMessage; receiveChannel.onopen = myHandleOpen; receiveChannel.onclose = myHandleClose; } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'datachannel' in that specification. Candidate Recommendation Basic definition. ...
RTCPeerConnection.createDataChannel() - Web APIs
Web › API › RTCPeerConnection › createDataChannel
: null. protocol Optional The name of the sub-protocol being used on the RTCDataChannel, if any; otherwise, the empty string (""). Default: empty string, "". This string may not be longer than 65,535 bytes. negotiated Optional By default (false), data channels are negotiated in-band, where one side calls createDataChannel, and the other side listens to the RTCDataChannelEvent event using the ondatachannel EventHandler . Alternatively (true), they can be negotiated out of-band, where both sides call createDataChannel with an agreed-upon id. Default: false. id Optional An 16-bit numeric ID for the channel; permitted values are 0-65534. If you don't include this option, the user agent will select an ID for you. The options which can be configured using the RTCDataChannelInit dictionary represent...
... to send and receive messages on it (For brievity, the example assumes onnegotiationneeded is set up). ...
RTCPeerConnection - Web APIs
Web › API › RTCPeerConnection
vent is sent immediately after the call setRemoteDescription() and doesn't wait for the result of the SDP negotiation.onconnectionstatechangeThe RTCPeerConnection.onconnectionstatechange property specifies an EventHandler which is called to handle the connectionstatechange event when it occurs on an instance of RTCPeerConnection. This happens whenever the aggregate state of the connection changes.ondatachannel The RTCPeerConnection.ondatachannel property is an EventHandler which specifies a function which is called when the datachannel event occurs on an RTCPeerConnection. This event, of type RTCDataChannelEvent, is sent when an RTCDataChannel is added to the connection by the remote peer calling createDataChannel().onicecandidateThe RTCPeerConnection property onicecandidate property is an EventHandle...
... to the oneventname property of this interface. connectionstatechange Sent to the RTCPeerConnection object when the overall connectivity status of the RTCPeerConnection changes. Also available through the onconnectionstatechange event handler property. datachannel Sent to the RTCPeerConnection object when the remote peer adds an RTCDataChannel to the connection. Also available through the ondatachannel event handler property. icecandidate Sent to the peer connection to request that the specified candidate be transmitted to the remote peer. Also available through the onicecandidate event handler property. icecandidateerror An error of type RTCPeerConnectionIceErrorEvent which is sent to the connection if an error occurred during ICE candidate gathering. The event's properties describe the e...
Index - Web APIs
Web › API › Index
State, Event Handler, ICE, Property, RTCPeerConnection, Reference, WebRTC, onconnectionstatechange The RTCPeerConnection.onconnectionstatechange property specifies an EventHandler which is called to handle the connectionstatechange event when it occurs on an instance of RTCPeerConnection. This happens whenever the aggregate state of the connection changes. 3435 RTCPeerConnection.ondatachannel Event Handler, Experimental, Property, RTCPeerConnection, Reference, WebRTC, ondatachannel The RTCPeerConnection.ondatachannel property is an EventHandler which specifies a function which is called when the datachannel event occurs on an RTCPeerConnection. This event, of type RTCDataChannelEvent, is sent when an RTCDataChannel is added to the connection by the remote peer calling create...
RTCDataChannelEvent.channel - Web APIs
Web › API › RTCDataChannelEvent › channel
DataChannel associated with the event. Syntax var channel = RTCDataChannelEvent.channel; Value A RTCDataChannel object representing the data channel linking the receiving RTCPeerConnection to its remote peer. Example The first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic. ...
RTCDataChannelEvent - Web APIs
Web › API › RTCDataChannelEvent
t.channel returns the RTCDataChannel associated with the event.MethodsThis interface has no methods, but inherits methods from: Event Examples In this example, the datachannel event handler is set up to save the data channel reference and set up handlers for the events which need to be monitored. The channel property provides the RTCDataChannel representing the connection to the other peer. pc.ondatachannel = function(event) { inboundDataChannel = event.channel; inboundDataChannel.onmessage = handleIncomingMessage; inboundDataChannel.onopen = handleChannelOpen; inboundDataChannel.onclose = handleChannelClose; } See A simple RTCDataChannel sample for another, more complete, example of how to use data channels. Specifications Specification Status Comment WebRTC 1.0:...
A simple RTCDataChannel sample - Web APIs
Web › API › WebRTC API › Simple RTCDataChannel sample
RTCPeerConnection.createDataChannel() and set up event listeners to monitor the channel so that we know when it's opened and closed (that is, when the channel is connected or disconnected within that peer connection). It's important to keep in mind that each end of the channel has its own RTCDataChannel object. Set up the remote peer remoteConnection = new RTCPeerConnection(); remoteConnection.ondatachannel = receiveChannelCallback; The remote end is set up similarly, except that we don't need to explicitly create an RTCDataChannel ourselves, since we're going to be connected through the channel established above. Instead, we set up a datachannel event handler; this will be called when the data channel is opened; this handler will receive an RTCDataChannel object; you'll see this below. Set up the...