Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XHR onsendstream progress event fires slow #14085

Open
1 task done
dlewis23 opened this issue Jul 17, 2024 · 0 comments
Open
1 task done

XHR onsendstream progress event fires slow #14085

dlewis23 opened this issue Jul 17, 2024 · 0 comments
Labels
bug ios needs triage This issue hasn't been reviewed by maintainers

Comments

@dlewis23
Copy link
Contributor

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

When doing an XHR upload the onsendstream event is not fired often if the user has a slow connection (< ~5 Mbps). It can take many seconds in-between event fires. This means you can not get a very accurate status of the upload or a nice progress. It seems to be only updating for every 250 - 750 KB of data sent.

Expected Behavior

The onsendstream event should fire more often even if the connection or progress is slow.

Actual behavior

The onsendstream is fired at long intervals when the user has a slow connection.

Reproducible sample

var uploadData = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'upload_file.bin').read();

var xhr = Titanium.Network.createHTTPClient();
xhr.onsendstream = function(e){ 
	console.log(e.progress);
};

xhr.onload = function(e) {
	xhr.abort();
	xhr = null;
};

xhr.open('POST','https://nyc.speedsmart.net/upload.php', true);
xhr.send({media: uploadData});

Steps to reproduce

Use the above code to upload a file and watch the progress, if you have a fast connection it will work as expected, on a slow connection you will see long pauses between the progress events being fired.

To slow your connection use: network link conditioner from Xcode additional tools and set a profile with a 1 Mbps upload speed. You can get Xcode additional tools here: https://download.developer.apple.com/Developer_Tools/Additional_Tools_for_Xcode_15.4/Additional_Tools_for_Xcode_15.4.dmg

Platform

iOS

SDK version you are using

12.4.0.GA

Alloy version you are using

No response

@dlewis23 dlewis23 added bug needs triage This issue hasn't been reviewed by maintainers labels Jul 17, 2024
@m1ga m1ga added the ios label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ios needs triage This issue hasn't been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants