-
Notifications
You must be signed in to change notification settings - Fork 23
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 value is defined but not honored #7
Comments
@briandeanda I have the same problems, timeout xhr.onerror is only called when I change my network status, for example, close wifi or switch to other wifi . |
@cikai Keep us updated if you find a workaround. |
facing the same problem! |
Does this only happen on android? |
+1 running android on galaxy s5 |
I think XMLHttpRequest is implemented by react native and doesn't support the timeout feature. Therefore, a different mechanism is required to add timeout. Therefore this project is X| |
a working solution: JakeChampion/fetch#175 (comment) |
I've had trouble reproducing this and could use help tackling it down and curious if later versions of React Native. I'm a bit at a loss, as timeouts have been supported natively since
Yes, while React Native does implement XMLHttpRequest, it accepts a
The downside of JakeChampion/fetch#175 (comment) is that it doesn't cancel the corresponding native request http request. Rather, on the client side, it just rejects the caller's promise. While it can be considered a work around if you aren't concerned by that, it's not a true timeout that many of us are looking for. |
Hi Aj, thanks for the attention. I'm currently using "react-native": "0.51.0" and a samsung galaxy s5 to test over adb (usb cable). that is running android 7.0 I've tested with and without the chrome debugger attached (this can change behaviour). Agree with downside of wrapping a timeout. A better solution would be great. If the http request is never cancelled, and never times out, is that an open socket until the app is completely closed? personally i can't believe this very basic feature is missing from the stack! hence why so many projects like yours exist. would be great if i can get it to work. cheers! |
Thanks for the environment info 👍
There's supposed to be a global default timeout on all connections. However, we were running an earlier version of React Native when putting this together because we noticed requests seemed to hang indefinitely, and then during a network change event, they would then all come back and resolve/reject. |
Maybe I faced with the same problem.
How can we make this case jump into catch() after timeout was reached? |
I was faced with the same issue, and after a long search I found out what was going wrong. The timeout option that React Native provides for This is at least true for Android - I think the iOS implementation is more sensible, but I didn't investigate further. |
For example, if I set a timeout of 2000, the network call does not error out and
xhr.ontimeout
is never called. When I log the values ofinit
i can see that timeout is defined, I can also see that thexhr.timeout
is set.This happens on a Motorola Moto E2 Android 5.1, API 22 with React Native 0.45.1
The text was updated successfully, but these errors were encountered: