Upload progress for AppTunnel data

The AppConnect library and the Ivanti client app are responsible for tunneling network connections using AppTunnel with HTTP/S tunneling.

The AppConnect for iOS Cordova Plugin generates the 'appconnect.uploadProgressDidChange' event when an AppConnect app uploads data through AppTunnel. The event is triggered only for URLs which are tunneled by AppConnect as configured in the Ivanti unified endpoint manager (UEM). The Ivanti UEM are: Ivanti Endpoint Manager Mobile and Ivanti Neurons for MDM.

The 'appconnect.uploadProgressDidChange' event

To allow your app to display the upload progress for data uploaded through AppTunnel, add the following event listener to your document object:

'appconnect.uploadProgressDidChange'

The following table describes the parameters.

Table 4.  appconnect.uploadProgressDidChange event parameters

Parameters

Description

requestURL

The requested URl.

bytesWritten

The number of bytes written in the latest write.

totalBytesWritten

The total number of bytes written for the connection with this request.

totalBytesExpectedToWrite

The total number of bytes the connection expects to write.

In some cases, such as for streams, the totalBytesExpectedToWrite parameter may be 0. The appconnect.uploadProgressDidChange event is sent on NSURLSession delegate callback. The parameters from the NSURLSession delegate callback (URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) are forwarded to appconnect.uploadProgressDidChange event.
See also Apple developer documentation: https://developer.apple.com/documentation/foundation/nsurlsessiontaskdelegate/1408299-urlsession?language=objc

Example  

document.addEventListener('appconnect.uploadProgressDidChange',

this.uploadProgressDidChange,

false);

...

uploadProgressDidChange: function (event) {

console.log("(" + event.requestURL + ")uploadProgressDidChange: " + event.bytesWritten + "B, " + event.totalBytesWritten + "B, " + event.totalBytesExpectedToWrite + "B");

document.getElementById('progress').innerHTML = "<font color=\"green\">Uploading " + event.totalBytesWritten + "B of " + event.totalBytesExpectedToWrite + "B</font>";

}