Open wzoet opened 2 years ago
It seams that this issue is caused by changes in iOS as also mentioned in https://github.com/react-native-webview/react-native-webview/issues/2281. The solution as specified by nverwer to disable NSURLSession makes the issue disappear.
Of course this is only a workaround and not the real solution of this issue. I will leave this issue open as I don't know whether Azure signalr library should be adapted to the new implementation in iOS15.
Looks like the WebSocket connection is closed by iOS. Since it is the SignalR client, I don't think there is much that Azure SignalR SDK can help with.
Can "re-start the connection" once 1006 is detected workaround this issue? For example, with such approach: https://github.com/Azure/azure-signalr/blob/e6c3768de36d0c0edd260d867bb15916868ef3b4/samples/ChatSample/ChatSample.Net50/wwwroot/index.html#L168-L174
i've had luck keeping some background task running in the webview like an interval or request animation frame while the webview or browser is backgrounded like:
setInterval(() => {
// keeps websocket open while app / webpage is backgrounded
console.log('keep alive');
}, 2000);
or
function repeatOften() {
requestAnimationFrame(repeatOften);
}
requestAnimationFrame(repeatOften);
Any update on this issue? @wzoet @spencercap @spencercap @mattetti
Unfortunately not. OSX and iOS have implemented this as experimental feature. And no workaround seems to be available. We advise turning this feature off as a workaround in our user manual.
this is definitely a spotty flow on mobile. especially on crowded LTE networks as well as device to device on firmware versions...
alas, we've had some luck keeping the thread alive by playing audio in the background (even a completely silent audio track) as demo'd in our algorand library here: https://github.com/thencc/algonautjs/blob/65142a39bff51b49a2ce4924b8ec585dd3284f04/src/index.ts#L2301-L2332
this still an issue? @wzoet @spencercap @spencercap @mattetti
I'm developing a web view app that requires sockets, and it was lovely to discover this error when I finally tested it on mobile... Has anyone found a solution?
@SkylarkingMonkey it was such an issue we abandoned the approach and haven't tried again since.
Issue is really bad :( We are using auth with SignalR and smart-id. Whenever user on iphone goes to the app to confirm the pin, connection is aborted and user is not going anywhere. Reconnect doesn't help since when it tries to reconnect it is already too late.
@vicancy @wzoet @spencercap @SkylarkingMonkey @EvaldasMazeika how did you guys resolved the issue ? is there some code
@vicancy @wzoet @spencercap @SkylarkingMonkey @EvaldasMazeika revolved this by updating to the new Microsoft package and added the 2 reconnection and reconnected events, so it was able to reconnect it and in the reconnected event i was able to grab the missed message
Describe the bug
We are using Azure SignalR to connect to a web service we are running. This system is running for several years now without any issues. Recently we have begun to see 1006 disconnection errors on iOS. The error occurs when a user uses our software on an iPhone. Our software interacts with a 3rd party that sends an authorization request (push message) to another app on the same phone. To authorize our request, the user has to acknowledge the request within the app of the 3rd party. When the user does not switch back instantly to safari, the connection gets dropped with error 1006.
Searching for the error makes me think it has something to do with background network traffic being forcibly closed when switching to another app.
We are looking if auto reconnect can help us fix this issue. Our connection settings are set to ping every 30 seconds and normally we don't experience any timeouts or connection drops.
To Reproduce
Enable debug mode within the iPhone and open a random SignalR powered website. Open the web debug window in OSX to see console messages on the Mac. Briefly switch to another random app for 1-2 seconds. Go back to safari. The console will show error 1006.
Exceptions (if any)
WebSocket connection to <> failed: The operation couldn’t be completed. (kNWErrorDomainPOSIX error 53 - Software caused connection abort)
Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ().'.
Further technical details
The libraries we are currently using are:
Thanks for thinking along.