2

I'm facing cross-subdomain / port problem with Socket.io. In example in Opera, when I disable Flash Socket.io automatically fallback to JSONP - and that's not good (XHR is way better).

I'm using now test subdomain, let's call it test.example.com. I tried many solutions.

  • http://data.test.example.com:80
  • http://test.example.com:8000
  • http://example.com:8000

None of solutions worked. Any hints? Maybe should I use nginx as reverse proxy? Something like http://test.example.com/data/?

ThomK
  • 637
  • 2
  • 8
  • 21

1 Answers1

3

I'm facing cross-subdomain / port problem with Socket.io. In example in Opera, when I disable Flash Socket.io automatically fallback to JSONP - and that's not good (XHR is way better).

Good question. I also have a "spinning throbber" when using Opera. But after some searching I think that Opera does not yet support CORS. You have to use CORS to get around same origin policy. I think the only option for socket.io would be to add server-sent-event(socket.io does not yet have server-sent-event, which I think has cross domain support). You could also try and fill an issue with socket.io(don't think they will put this in front of issues queue). But maybe this issue might be working server-sent-event

Also I think you could just enable flash-sockets instead, which fixes all problems. Almost all(99%) user do have flash.

Or you like you are saying you could use Nginx as reverse proxy. Also a some users do use HAProxy instead.

Community
  • 1
  • 1
Alfred
  • 60,935
  • 33
  • 147
  • 186
  • Flash fall backs are no good :( implement server-side events instead. – Raynos Jul 19 '11 at 21:33
  • plugins are slow, laggy, easy to crash, leaky abstractions and HTML/DOM are always superior. – Raynos Jul 19 '11 at 21:46
  • True that, Flash gets you started really fast though! Works in almost all browsers(99%) and has very good support in socket.io. No spinning throbber for example... – Alfred Jul 19 '11 at 22:30