Class wsc.DataReceiver
Exposes the capability of a DataTransfer to receive data over the established data channel.
Constructor Attributes | Constructor Name and Description |
---|---|
Instance created by DataTransfer.
|
Event Attributes | Event Name and Description |
---|---|
onMessage(evt)
Event handler called when a raw data object is received by the data channel of the DataTransfer object.
|
Class Detail
wsc.DataReceiver()
Instance created by DataTransfer. An object of this class is created by
DataTransfer and set to the member dataReceiver.
The instance of this class can be obtained by calling {DataTransfer.getReceiver()}.
The instance of this class can be obtained by calling {DataTransfer.getReceiver()}.
- See:
- wsc.DataTransfer
Event Detail
onMessage(evt)
Event handler called when a raw data object is received by the data channel of the DataTransfer object.
Application should override this function to handle the received data by itself.
If it is not overridden by the application, the received raw data object cannot be passed to the application to handle it.
var receiver = dataTransfer.getReceiver(); receiver.onMessage = function(evt) { var rcvdDataElm = document.getElementById("rcvData"); rcvdDataElm.value = evt.data; }
- Parameters:
- {object} evt
- The event object received by data channel. It is passed to the function complete and unmodified.
The raw data can be fetched by evt.data, and supports the following data types:
- Text string
- BLOB raw data
- ArrayBuffer
- ArrayBufferView