I am trying to use RN's fetch() method with http connection alive.
I tried with header 'Connection: keep-alive' but it does not seem to work. I cannot use http.Agent because http module is not supported in React Native. I searched but cannot find an alternative module.(XmlHttpRequest does not work also)
Question: What can I do to keep http connection alive in React Native's environment?
My ultimate purpose is to authenticate a NTLM server in React Native's JavaScriptCore, the authentication needs keep-alive http connection. Any other suggestion is also appreciated.
On Android (and presumably similarly on iOS), the OkHttp client used by ReactNative will by default keep either a Http/1.1 or Http/2 connection alive and reuse it. You should check whether the server is closing the response.
https://en.wikipedia.org/wiki/HTTP_persistent_connection#HTTP_1.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With