News for hackers. Stuff that matters.
Re:EasyXDM – crossdomain javascript done right by radagaisus on Friday February 10, 2012 @07:55AM (#3575550)
Two weeks ago we evaluated a bunch of cross domain solutions. The Web Intents examples didn't even work. Porthole wasn't maintained. EasyXDM was good but didn't have the flow we wanted. We eventually decided to use socket.io
Re:EasyXDM – crossdomain javascript done right by jacobolus on Friday February 10, 2012 @08:10AM (#3575604)
You wanted to send messages from one browser window to another within the same browser (or from one frame to another), so you used socket.io, which presumably requires a persistent server connection in both windows/frames? That seems rather silly, tying up not only your server resources but also your users’ CPU and bandwidth &c., entirely unnecessarily. (Or maybe I’m misunderstanding your use case..?)
Re:EasyXDM – crossdomain javascript done right by radagaisus on Friday February 10, 2012 @11:25AM (#3576345)
You got the use case wrong :-) We wanted to continually send information from third party sites to our site, that's why we picked socket.io. But for our login flow socket.io felt like on overkill, so I tried to use EasyXDM.
Re:EasyXDM – crossdomain javascript done right by sciurus on Friday February 10, 2012 @12:01PM (#3576507)
Could you share the approaches you tried for login?
Re:EasyXDM – crossdomain javascript done right by radagaisus on Saturday February 11, 2012 @09:42AM (#3579312)
Sure. Basically the user is on site A and presses a link that opens a pop up from our site. The pop up logs him in, either through oAuth or a local login. Then site A should get the user details back.

EasyXDM works with iframes, not with popups, so the only option we had (well, the one I thought about) was sending a request to the server every few ms to check if the user logged in. That's pretty horrible. We needed continuous updates from site A to our site so we decided to use socket.io. Sockets don't have sessions, so we listen to a random channel name, and pass that channel name to the popup, which sends the user details as a message to that channel.

That's still complicated. I'm still not sure it's the right approach. And I'm not an expert. But it works for now.