Skip to content
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

Patch to fix iPod/iPad/iPhone browser from crashing when resuming on a sites using the websocket transport #426

Merged
merged 1 commit into from
May 1, 2012

Conversation

NathanaelA
Copy link

This will wrap the websocket.send in a setTimeout call only on idevices. The iDevice will crash because the browser hasn't detected that the socket has closed before the send is triggered. This will allow the browser to detect that the socket is invalid before attempting to send.

rauchg added a commit that referenced this pull request May 1, 2012
Patch to fix iPod/iPad/iPhone browser from crashing when resuming on a sites using the websocket transport
@rauchg rauchg merged commit ebc31ab into socketio:master May 1, 2012
@rauchg
Copy link
Contributor

rauchg commented May 1, 2012

Thanks a lot! It's nitpicks time:

  • iDevice -> iOS ?
  • 2 spaces instead of 3 in setTimeout callback
  • Space prior to the 0 in setTimeout

@NathanaelA
Copy link
Author

LOL, iOS does make more sense -- not sure where my brain was at.... I just didn't want people to think it was iPad or iPhone only so I went with iDevice.
Spaces, didn't even notice those -- good catch.

@rossholdway
Copy link

Hi

I'm currently running iOS 6.02 and this fix does not resolve the crash issue for me. Any other ideas or more information on this would be great.

Thanks

@rauchg
Copy link
Contributor

rauchg commented Jan 27, 2013

@3rd-Eden do you know if this workaround is sufficient?

@3rd-Eden
Copy link
Contributor

@guille This is the correct fix for the issue as the setTimeout the WebSocket some extra time to set the correct readyState on the WebSocket.

@rossholdway what are you running and iPad, iPod, iPhone and which generation of those. And what is the user agent string of your browser and browser version?

@rossholdway
Copy link

@3rd-Eden I'm running this on the iPhone 5 within a Phonegap application (so basically within a UIWebView). My user agent string is

Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_2 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A551

io.util.ua.iDevice looks to be returning true when running.

@Yaffle
Copy link

Yaffle commented Jan 28, 2013

hm.... did anybody report this bug to iOS devs?

@3rd-Eden
Copy link
Contributor

Is this reproducible without phonegap? Just so we can rule that out as offender.

Sent from my iPhone

On Jan 28, 2013, at 3:19 AM, Yaffle [email protected] wrote:

hm.... did anybody report this bug to iOS devs?


Reply to this email directly or view it on GitHub.

@rossholdway
Copy link

So I've been looking into this over the past few days and can confirm that running outside of Phonegap there is no crash caused on my device.

Removing socket.io from my application does prevent the crashes, so I think the issue is likely connection related although maybe not directly caused by socket.io itself. I've submitted a bug report to Phonegap/Apache Cordova.

Thanks,
Ross

neverfox pushed a commit to neverfox/socket.io-client that referenced this pull request Jun 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants