new FileTransfer()
Methods
-
abort(fileConfig)
-
Abort single file transfer session using the fileTransferId that was given in the fileConfig.
Parameters:
Name Type Description fileConfigFileConfig the fileConfig that represents the file transfer session to be aborted. If not provided, abort all file transfer sessions.
-
abort(fileConfigs)
-
Abort multiple file transfer sessions using the fileTransferIds that are given in the fileConfigs array.
Parameters:
Name Type Description fileConfigsArray the fileConfigs array that represents the file transfer sessions to be aborted. if not provided, abort all file transfer sessions.
-
accept(fileConfig, extHeaders)
-
Accept single file transfer request with the given fileConfig, or not, providing that means totally accept the request.
Parameters:
Name Type Description fileConfigFileConfig Optional: the accepted fileConfig.
extHeadersObject Optional: extension headers.
-
accept(fileConfigs, extHeaders)
-
Accept multiple files transfer request with the given fileConfigs, or not, providing that means totally accept the request.
Parameters:
Name Type Description fileConfigsArray Optional: an array of fileConfig.
extHeadersJSON Optional: extension headers.
-
addParticipants(participants)
-
Add participants to the created FileTransfer object. This function is used when the target is a conference address and the client wants to transfer files to these participants.
Parameters:
Name Type Description participantsArray an array of participants name.
-
decline(code, reason, extHeaders)
-
Decline the file transfer request with a given code and reason.
Parameters:
Name Type Description codeNumber the specified error code.
reasonString the specified error reason.
extHeadersJSON extension headers.
-
getFileConfigs() → {Array}
-
Gets the configuration of FileTransfer.
Returns:
fileConfigs - the fileConfigs array that represents the file transfer.
- Type
- Array
-
getInitiator()
-
Gets initiator of the FileTransfer
-
getState() → {wsc.CallState}
-
Gets the signalling state of FileTransfer.
Returns:
state - The signalling state of the FileTransfer.
- Type
- wsc.CallState
-
getTarget()
-
Gets target of the FileTransfer.
-
setChunkSize(size)
-
Set the trunk size.
Parameters:
Name Type Description sizeNumber the trunk size in bytes; default value is 2048.
-
setSecure(isSecure)
-
Set the transport layer to be secure or not.
Parameters:
Name Type Description isSecureBoolean Default value is true.
-
start(fileConfig, extHeaders)
-
Start file transfer with single file. The default operation is to push the file to target. If fileConfig.props.direction is set to 'receive', the operation is to pull file from target. After invoking this method, the SDK will set the 'fileTransferId' to the fileConfig object.
Parameters:
Name Type Description fileConfigFileConfig the configuration for the transferring file.
extHeadersJSON Optional: extension headers.
-
start(fileConfigs, extHeaders)
-
Start file transfer with multiple files. The default operation is to push file to target. If fileConfig.props.direction is set to 'receive', the operation is to pull file from target. After invoking this method, the SDK will set the 'fileTransferId' to each fileConfig object.
Parameters:
Name Type Description fileConfigsArray An array of fileConfig.
extHeadersObject Optional: extension headers.
Events
-
onConnectionStateChange
-
callback function for the file transfer connection state changes.
Parameters:
Name Type Description stateConnectionState the current file transfer connection state.
-
onFileData
-
callback function for incoming file transfer data.
Parameters:
Name Type Description dataFileData The received file data.
-
onFileTransferFailure
-
Callback function for file transfer failure.
Parameters:
Name Type Description fileTransferIdString the file transfer ID.
statusNumber the status code.
reasonString the reason description.
-
onFileTransferSuccess
-
Callback function for file transfer success.
Parameters:
Name Type Description fileTransferIdString the file transfer ID.
-
onMessage
-
For extensibility - Processes the received JSON message between the client and WebRTC Session Controller server.
Application can override this method to handle the JSON message directly.Parameters:
Name Type Description msgObject the JSON message between client and WebRTC Session Controller server.
-
onProgress
-
Callback function for sending file progress data.
Parameters:
Name Type Description progressFileProgressData The progress data.
-
onStateChange
-
callback function for FileTransfer signalling state changes.
Parameters:
Name Type Description statewsc.CallState An instance of CallState object.
extHeadersJSON Optional. Extension headers.