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

xhr-polling doesnt work on embedded webviews (phonegap, cordova) #1025

Closed
max-mapper opened this issue Sep 9, 2012 · 4 comments
Closed

xhr-polling doesnt work on embedded webviews (phonegap, cordova) #1025

max-mapper opened this issue Sep 9, 2012 · 4 comments

Comments

@max-mapper
Copy link

if you restrict the transports (on both server and client settings) to ['websocket', 'xhr-polling'] then embedded webviews using socket.io won't be able to connect and will emit the connect_failed event

@rauchg
Copy link
Contributor

rauchg commented Sep 9, 2012

Oh so setting secure: true still fails correct?

@rauchg
Copy link
Contributor

rauchg commented Sep 9, 2012

If you can get me some more debugging information that would be great.

@max-mapper
Copy link
Author

ok, turns out socket.io assumes that if window.location.href is not the same host as the host you pass into io.connect then it should skip xhr-polling. you can override this behavior by monkeypatching thusly:

io.Socket.prototype.isXDomain = function(){ return false; }

@rauchg
Copy link
Contributor

rauchg commented Sep 9, 2012

* it assumes that only if CORS is not supported as well (io.util.ua.hasCORS needs to be false). Which is not on Android apparently, but WebViews still have the ability to disregard the origin security model. I'm introducing an option to solve this more elegantly without the override.

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

No branches or pull requests

2 participants