-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
socket.io crashes Mobile Safari on iOS #976
Comments
Is this using Websocket? |
Yes, the client is making a Websocket connection to the socket.io server. |
Yep we've gotten several reports of Mobile Safari crashing. We should add user agent sniffing to the websocket feature detection to exclude it unfortunately. Thoughts @3rd-Eden ? |
Can we narrow it down to a specific Mobile Safari or is it all? |
I'm seeing the crash on 5.1; haven't been able to try it out on other versions. |
We already patched the issue in the supplied gist: socketio/socket.io-client@8dc031d |
Wait so why is this still happening? |
Are you running on Wifi, 3g, or using any proxy settings in your network? |
What version of socket.io are you using? I don't see that in the supplied bug report. Same with iOS version. |
Thanks -- I was on 0.9.6 and upgraded to 0.9.8 and the issue went away. Sorry about that -- didn't realize it had been fixed in the interim. |
This issue is still happening with v 0.9.16. Steps to reproduce:
Environment:
More info about the crash info: #1210 |
The exact same problem! Socket.io v0.9.16 Any fix? Thank you! |
Is this only with phonegap? |
@guille could be because phonegap runs in a webview which has different restrictions than a regular safari. I wonder if Chrome for iOS also exhibits the same issues as it also runs in a webview. |
only on phonegap for me. The problem is when the device goes to sleep mode for a while and then resume. Our workaround was to disconnect and reconnect the socket manually listening to the resume and pause phonegap events. |
@fernandopg If this helps on your PhoneGap var conn = io.connect(url);
function pause() {
conn.disconnect();
}
function resume() {
conn.socket.reconnect();
}
// Assign function to as corresponding phonegap events listeners. |
Seems to work! I tried this in older versions of phonegap and didn't work but now seems to work! Thanks @cayasso !!! |
@fernandopg Awesome!!! |
Thanks @cayasso. Do you need to disable the socket.io reconnect property as well? |
i'm getting the same "resume from sleep" crashes when using on the server side: node.js & socket.io (v0.10.21 from npm) and connecting to it via mobile chrome & safari in ios7 (client side which uses socket.io.js v 0.9.16). I've had no luck nor have been able to pinpoint what exactly is taking place when it crashes. what i do know is that after i leave the mobile browser & lock the screen, node.js disconnects the websocket connection. upon resuming from sleep and reopening the mobile browser a new websocket connection is established and some data transfers from server to client, but the crash happens soon thereafter. google hasn't been much help either, so i'm hoping someone here can guide me |
@blairvanderhoof No, no need to disable reconnect. |
@cayasso That's great but I thought socket reconnect was causing the crash? |
@blairvanderhoof yes it is in certain way, that is why we only disconnect and reconnect for PhoneGap background events leaving it intact for other regular disconnect events. EDIT: You can always turn off |
I'm still getting this issue, in mobile chrome. |
@dchen05 with 1.0? |
@guille 9.16, but I will try 1.0 and report back |
Having same issue with 1.2.0 and PhoneGap. Seems that crashing may happen after calling
|
But actually what if I don't want to disconnect on app I have major feature when user sends an invitation to online match to another user and sees "waiting dialog". I don't want to make him just stop and wait, he can go to another app or home screen. And when the response from another user is recieved I can show system local notification about starting the match and ask him to bring my app back. |
Can you test with latest instead of |
Okay, I will. What about my second question? What if need active connection in background for some time? |
You should basically handle reconnections appropriately. You don't have any guarantees that while you switch apps the connection will stay on anyways, due to other potential problems. Socket.IO will reconnect on your behalf automatically when you switch back. |
What do you mean by "appropriately"? How would you suggest to handle use case I mentioned above? |
I am having an issue with Mobile Safari crashing on iOS. The following will consistently reproduce a crash for me:
I think it is related to this:
https://gist.github.com/2052006
The page above includes a workaround, but I'm not sure how to implement this workaround with socket.io.
The text was updated successfully, but these errors were encountered: