Cross-domain connection in Socket.IO

CamelCamelCamel picture CamelCamelCamel · Jan 23, 2012 · Viewed 38.7k times · Source

Is it possible to use Socket.IO in a cross domain manner? If so, how? The possibility is mentioned around the web but no code examples are given anywhere.

Answer

igorw picture igorw · Jan 23, 2012

Quoting the socket.io FAQ:

Does Socket.IO support cross-domain connections?

Absolutely, on every browser!

As to how it does it: Native WebSockets are cross-domain by design, socket.io serves a flash policy file for cross-domain flash communication, XHR2 can use CORS, and finally you can always use JSONP.