Index


Class wsc.DataTransfer

Manage a data channel between two peers.

Class Summary
Constructor Attributes Constructor Name and Description
 
An instance of this class is created by the Call object if the CallConfig includes the data channel.
Field Summary
Field Attributes Field Name and Description
 
The label of the data channel indicated by this DataTransfer object.
Method Summary
Method Attributes Method Name and Description
 
Returns the DataReceiver object of the DataTransfer.
 
Returns the DataSender object of the DataTransfer.
 
Returns a string indicating the status of the DataTransfer object.
Event Summary
Event Attributes Event Name and Description
 
Event handler called when the dataChannel of a DataTransfer object is closed.
 
Event handler called when the dataChannel of a DataTransfer object encounters an error.
 
Event handler called when the dataChannel of a DataTransfer object is opened.
Class Detail
wsc.DataTransfer()
An instance of this class is created by the Call object if the CallConfig includes the data channel. It is returned to users by the Call object's callback function onDataTransfer(dataTransfer).
See:
wsc.Call
Field Detail
label
The label of the data channel indicated by this DataTransfer object.
Method Detail
{wsc.DataReceiver} getReceiver()
Returns the DataReceiver object of the DataTransfer. The member DataReceiver will be created when a data channel is set up successfully.
Returns:
{wsc.DataReceiver} object

{wsc.DataSender} getSender()
Returns the DataSender object of the DataTransfer. The member DataSender will be created when a data channel is set up successfully.
Returns:
{wsc.DataSender} object

{String} getState()
Returns a string indicating the status of the DataTransfer object.
It can return one of the following values:
Returns:
{String} "none", "starting", "open," or "closed"
Event Detail
onClose()
Event handler called when the dataChannel of a DataTransfer object is closed. An event is provided as parameter, when the handler is invoked.
 function onDataTransfer(dataTransfer) {
   console.log("Data transfer call back is called!");
   // Keep the dataTransfer reference, and initialize the dataTransfer callback functions...
   myDataTransfer = dataTransfer;
   myDataTransfer.onOpen = onDCOpen;
   myDataTransfer.onError = onDCError;
   myDataTransfer.onClose = onDCClose;
 }
 
 function onDCClose(evt) {
   // Render the web page when the data channel is closed.
 }

onError()
Event handler called when the dataChannel of a DataTransfer object encounters an error. An event is provided as parameter, when the handler is invoked.
 function onDataTransfer(dataTransfer) {
   console.log("Data transfer call back called.");
   // Keep the dataTransfer reference, and initialize the dataTransfer callback functions...
   myDataTransfer = dataTransfer;
   myDataTransfer.onOpen = onDCOpen;
   myDataTransfer.onError = onDCError;
   myDataTransfer.onClose = onDCClose;
 }
 
 function onDCError(evt) {
   // Handle the error, and render the web page as appropriate.
 }

onOpen()
Event handler called when the dataChannel of a DataTransfer object is opened. An event is provided as parameter, when the handler is invoked.
 function onDataTransfer(dataTransfer) {
   console.log("Data transfer call back is called!");
   //keep the reference of dataTransfer, and initial the callback functions of dataTransfer.
   myDataTransfer = dataTransfer;
   myDataTransfer.onOpen = onDCOpen;
   myDataTransfer.onError = onDCError;
   myDataTransfer.onClose = onDCClose;
 }
 
 function onDCOpen(evt) {
   //do some render for web page when data channel is open
 }

Copyright © 2005, 2013, Oracle and/or its affiliates. All rights reserved.