I create a websocket with
let websocket = new WebSocket(host);
and assign its callbacks onopen, onmessage, onerror, onclose.
I can make a connection fine.
If I disable my wifi, my ios simulator will go offline. In this case, I get the onclose message. I have a timeout setup to try recreating the websocket.
When the timeout fires, the websocket tries to connect and the onclose is called with
onError = (evt) => {this.websocket = nulllet text = "Error: " + JSON.stringify(evt);console.log(text)
Error: {"isTrusted":false,"message":"The operation couldn’t be completed. Network is down"}[Fri Oct 09 2020 22:36:40.124] LOG Close: undefined
My Network then appears to be down, even though it is not.
Refreshing the React Native app does not fix the issue. I have to close out the app then restart.
Is this a problem with React Native not detecting online status?
With Websocket?
With iOS?
Error: {"isTrusted":false,"message":"The operation couldn’t be completed. Network is down"}