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

No timeout on XMLHttpRequest #4648

Closed
bobylito opened this issue Dec 8, 2015 · 5 comments
Closed

No timeout on XMLHttpRequest #4648

bobylito opened this issue Dec 8, 2015 · 5 comments
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. JavaScript Resolution: Locked This issue was locked by the bot.

Comments

@bobylito
Copy link

bobylito commented Dec 8, 2015

It seems that React Native is not implementing timeout property on XMLHttpRequest.

@facebook-github-bot
Copy link
Contributor

Hey bobylito, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If this is a feature request or a bug that you would like to be fixed by the team, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • We welcome clear issues and PRs that are ready for in-depth discussion; thank you for your contributions!

@skevy skevy added Good first issue Interested in collaborating? Take a stab at fixing one of these issues. JavaScript Help Wanted :octocat: Issues ideal for external contributors. labels Dec 13, 2015
@klvs
Copy link
Contributor

klvs commented Dec 13, 2015

Was this a result of code written by you (in your app) or from using a 3rd party library (parse, twilio, loopback, etc.)? Just curious. I'm working on a fix, but if it's not 3rd party code you could always use the fetch api in the meantime.

@bobylito
Copy link
Author

Thanks @klvs :) I'm working on fixing a third party library (algoliasearch-client) for React-Native :)

Does fetch implement any timeout?

klvs added a commit to klvs/react-native that referenced this issue Dec 16, 2015
klvs added a commit to klvs/react-native that referenced this issue Dec 16, 2015
@klvs
Copy link
Contributor

klvs commented Dec 18, 2015

@bobylito My apologies, I was mistaken in thinking fetch has a timeout. Somewhat surprised myself but should have research more. Regardless, hopefully my PR is of high enough quality and will help you if you're still looking for a fix.

klvs added a commit to klvs/react-native that referenced this issue Dec 20, 2015
Closes facebook#4648

Fix lint errors.

Make null check style to spec.
@mkonicek
Copy link
Contributor

Let's continue discussing on the PR so the discussion is in one place: #4832

ghost pushed a commit that referenced this issue Apr 15, 2016
…st for Android and iOS

Summary:Currently React-Native does not have `ontimeout` and `onerror` handlers for [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). This is an extension to [No timeout on XMLHttpRequest](#4648).

With addition to two handlers, both Android and iOS can now handle `ontimeout` if request times out and `onerror` when there is general network error.

**Test plan**

Code has been tested on both Android and iOS with [Charles](https://www.charlesproxy.com/) by setting a breakpoint on the request which fires `ontimeout` when the request waits beyond `timeout` time and `onerror` when there is network error.

**Usage**

JavaScript -

```
var request = new XMLHttpRequest();

function onLoad() {
    console.log(request.status);
};

function onTimeout() {
    console.log('Timeout');
};

function onError() {
    console.log('General network error');
};

request.onload = onLoad;
request.ontimeout = onTimeout;
request.onerr
Closes #6841

Differential Revision: D3178859

Pulled By: lexs

fb-gh-sync-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
fbshipit-source-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
zebulgar pushed a commit to nightingale/react-native that referenced this issue Jun 18, 2016
…st for Android and iOS

Summary:Currently React-Native does not have `ontimeout` and `onerror` handlers for [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). This is an extension to [No timeout on XMLHttpRequest](facebook#4648).

With addition to two handlers, both Android and iOS can now handle `ontimeout` if request times out and `onerror` when there is general network error.

**Test plan**

Code has been tested on both Android and iOS with [Charles](https://www.charlesproxy.com/) by setting a breakpoint on the request which fires `ontimeout` when the request waits beyond `timeout` time and `onerror` when there is network error.

**Usage**

JavaScript -

```
var request = new XMLHttpRequest();

function onLoad() {
    console.log(request.status);
};

function onTimeout() {
    console.log('Timeout');
};

function onError() {
    console.log('General network error');
};

request.onload = onLoad;
request.ontimeout = onTimeout;
request.onerr
Closes facebook#6841

Differential Revision: D3178859

Pulled By: lexs

fb-gh-sync-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
fbshipit-source-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. JavaScript Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants