new DataChannel(id, contact)
Creates a new call
Parameters:
Name | Type | Description |
---|---|---|
id |
String | call id |
contact |
Contact | called contact |
Fires:
- DataChannel#event:response
- DataChannel#event:accepted
- DataChannel#event:declined
- DataChannel#event:opened
- DataChannel#event:closed
- DataChannel#event:ended
- DataChannel#event:transferProgress
- DataChannel#event:transferComplete
- DataChannel#event:dataReceived
- DataChannel#event:error
Returns:
this
- Type
- DataChannel
Extends
Methods
-
<static> getAvailableEvents()
-
Returns available events for this class
Returns:
- Type
- Array.<string>
-
close()
-
Stops datachannel session with contact
Returns:
- Type
- Void
-
getContact()
-
Returns called contact
Returns:
DataChannel contact
- Type
- Contact
-
getId()
-
Returns datachannel session id
Returns:
DataChannel id
- Type
- string
-
getStatus()
-
Returns datachannel session status
Returns:
DataChannel status, value can be DATACHANNEL_STATUS_WAITING, DATACHANNEL_STATUS_ONGOING, DATACHANNEL_STATUS_ENDED
- Type
- Symbol
-
getType()
-
Returns datachannel session type
Returns:
DataChannel type
- Type
- Symbol
-
on(listener)
-
Adds a listener to a Observable event
Parameters:
Name Type Description listener
function - Inherited From:
- Overrides:
Returns:
this instance for chaining
- Type
- Observable
-
removeListener(eventType, listener)
-
Remove existing listener to Observable event
Parameters:
Name Type Description eventType
String listener
function - Inherited From:
- Overrides:
Returns:
this instance for chaining
- Type
- Observable
-
sendData(data, fileInfo)
-
Sends data over data channel (send side only)
Parameters:
Name Type Description data
any fileInfo
FileInfo relevant file information for the contact
Returns:
uuid of the data transfered
- Type
- Promise.<string>
Events
-
accepted
-
When contact accepts datachannel
Type: Void
-
closed
-
When the data channel effectively closed
Type: Void
-
dataReceived
-
Fired at the end of a data transfer when data has been received
Type: object
Properties:
Name Type Description uuid
string data
string -
declined
-
When contact decline datachannel
Type: Void
-
ended
-
When contact hangs up from 1-1 datachannel, 'from' property indicates which side initiated the ended, either 'remote' or 'local'
Type: object
Properties:
Name Type Description from
string -
error
-
When the data channel returns an error
Type: Void
-
opened
-
When the data channel effectively opened
Type: Void
-
response
-
When contact accepted or declined datachannel
Type: Void
-
transferComplete
-
Fired at the end of a data transfer
Type: TransferInformation
-
transferProgress
-
Fired periodically during a data transfer
Type: TransferInformation