Open alanjames1987 opened 10 years ago
@alanjames1987 that's strange. I'm using a similar setup here (cookie based auth with express) and things are working fine for me. What version of socket.io-client do you use? Do things work fine for you when testing from the browser?
I've been using 0.9.6 as the client and server. I've been using socket.io-session to connect my Express and Socket.IO sessions.
From what I can see it looks like PhoneGap just never works with cookies. I might be wrong on this but it looks like I will have to write my own authorization function to handle different requests from browsers or PhoneGap.
This should be no problem, but it's just a drag that PhoneGap didn't behave exactly like browsers do.
I'm having the same issue http://stackoverflow.com/questions/38550654/socket-io-auth-doesnt-work-on-cordova-mobile
@eldyvoon I would suggest switching from a cookie based auth to a token based.
In order to have Socket.IO and Express share the same session data a sessionStore and cookie have to be used. This works great on browers, but PhoneGap is giving me problems.
I referenced your Socket.IO example and the
socket.on('error'...
event keeps firing. I looked at my Socket.IO log and this is the error I am getting when PhoneGap tries to connect.I'm using PhoneGap 3.4.0 on Android 4.2.2 on a Galaxy Nexus.
Do you know how I can fix this?