Socket.IO中的跨域连接 [英] Cross-domain connection in Socket.IO
本文介绍了Socket.IO中的跨域连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以以跨域方式使用Socket.IO?如果是,如何?
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.
推荐答案
域连接?
绝对,在每个浏览器上!
Absolutely, on every browser!
关于它如何做:本机WebSockets是跨域的设计,socket.io提供了一个用于跨域闪存通信的闪存策略文件,XHR2可以使用CORS,最后你可以总是使用JSONP。
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.
这篇关于Socket.IO中的跨域连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文