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

Timeout XMLHttpRequest not working in Android #26240

Closed
navata opened this issue Aug 29, 2019 · 6 comments
Closed

Timeout XMLHttpRequest not working in Android #26240

navata opened this issue Aug 29, 2019 · 6 comments
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@navata
Copy link

navata commented Aug 29, 2019

Hi All,

I have use XMLHttpRequest for request to server. I have set timeout = 90000ms and my request about 14000ms. But It usually have error.

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = e => {
    if (xhr.readyState !== 4) {
        return;
    }

    if (xhr.status === 200) {
        console.log("success", xhr.responseText);
    } else {
        console.warn("error");
    }
};
xhr.open(
    "POST",
    "http://125.234.136.71/index.php?route=apiv4/post_timeout"
);
xhr.setRequestHeader("Content-type", "application/json; charset=utf-8");
xhr.timeout = 90000; // Set timeout to 90 seconds (90000 milliseconds)
xhr.ontimeout = function() {
    alert("Timed out!!!");
};
xhr.send();

My request is working on IOS and Postman, but it don't work on Android.
And more, I try set timeout = 0 (Infinite timer ) => it don't work -_-

@navata navata added the Bug label Aug 29, 2019
@react-native-bot react-native-bot added Platform: Android Android applications. 🌐Networking Related to a networking API. labels Aug 29, 2019
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Aug 29, 2019
@dulmandakh
Copy link
Contributor

Android requires HTTPS connections, please use HTTPS or disable HTTPS requirements for your app. Please see https://developer.android.com/training/articles/security-config

@navata
Copy link
Author

navata commented Aug 29, 2019

I have test https but timeout not working in Android. I try to set any value. (0, 1000, 90000 ...) but not working. But it working in IOS
In Android, it will waiting to until receive response or timeout from server.
You can test with my code and use https

@dulmandakh
Copy link
Contributor

dulmandakh commented Aug 29, 2019 via email

@navata
Copy link
Author

navata commented Aug 29, 2019

I use https but timeout don’t working.

@dsolimando
Copy link

Have same issue... and with HTTPS requests :/

@facebook facebook locked as resolved and limited conversation to collaborators Oct 4, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 🌐Networking Related to a networking API. Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants