如何解决使用Flash,Socket.IO和NodeJS这个(可能)跨域策略错误 [英] How to fix this (probably) cross domain policy error using Flash, Socket.IO and NodeJS

查看:1498
本文介绍了如何解决使用Flash,Socket.IO和NodeJS这个(可能)跨域策略错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation: http://kipos.bluecodestudio.com/holdthebomb/HoldTheBombWeb.swf cannot load data from http://23.29.126.76:8000/socket.io/1/?t=1356891827452.
    at io::Socket/doHandshake()[/Users/airrider3/github/AS3-Socket.IO-XHR-Polling/xhr-polling/src/io/Socket.as:139]
    at io::Socket/connect()[/Users/airrider3/github/AS3-Socket.IO-XHR-Polling/xhr-polling/src/io/Socket.as:110]
    at io::Socket()[/Users/airrider3/github/AS3-Socket.IO-XHR-Polling/xhr-polling/src/io/Socket.as:90]
    at io::IO$/connect()[/Users/airrider3/github/AS3-Socket.IO-XHR-Polling/xhr-polling/src/io/IO.as:36]
    at MainController/endOfbluecodeSplash()[/Users/airrider3/Dropbox/Projects/Kipos/Minigames/HoldTheBombWeb/src/MainController.as:41]
    at bluecodeSplash/endOfSplash()[/Users/airrider3/Dropbox/Projects/Kipos/Minigames/HoldTheBombWeb/src/bluecodeSplash.as:55]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at com.greensock.core::TweenCore/complete()[D:\_Flash\_AS3\src\com\greensock\core\TweenCore.as:178]
    at com.greensock::TweenLite/renderTime()[D:\_Flash\_AS3\src\com\greensock\TweenLite.as:477]
    at com.greensock.core::SimpleTimeline/renderTime()[D:\_Flash\_AS3\src\com\greensock\core\SimpleTimeline.as:93]
    at com.greensock::TweenLite$/updateAll()[D:\_Flash\_AS3\src\com\greensock\TweenLite.as:642]

我在使用Flash Builder,ActionScript项目,它连接到使用Socket.IO模块运行的NodeJS服务器。

I'm using Flash Builder, an ActionScript project, which connects to a server running NodeJS using the Socket.IO module.

要我用下面的库 HTTPS连接Socket.IO: //github.com/sbquinlan/AS3-Socket.IO-XHR-Polling 它完美地工作,而测试的地方,从Flash Builder。

To connect Socket.IO with AS3 I'm using the following library https://github.com/sbquinlan/AS3-Socket.IO-XHR-Polling which works perfectly while testing in local, from Flash Builder.

不过,如果托管在我的域名 [HTTP://kipos.blue$c$cstudio .COM / holdthebomb /] ,我想这是因为我没有正确使用任何的crossdomain.xml文件,引发此SecurityErrorEvent?我从来没有与这个主题得到了,说实话,所以我不知道这是错误。

However, if hosted on my domain [http://kipos.bluecodestudio.com/holdthebomb/], I suppose it raises this SecurityErrorEvent because I am not using any crossdomain.xml files correctly? I've never gotten along with this topic, to be honest, so I'm not sure if this is the error.

在任何情况下,我有以下crossdomain.xml文件:

In any case, I have the following crossdomain.xml file:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <site-control permitted-cross-domain-policies="master-only"/>
   <allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>

我有它在我的服务器上不同的地方。 (它应该是托管客户端上的?)。是的,游戏托管在蓝色codestudio.com,而游戏的服务器上的IP 23.29.126.76,端口8000上运行。

I have it in different places on my server. (Should it be on the hosting client?). Yes, the game is hosted on bluecodestudio.com, while the game's server is on the IP 23.29.126.76, running on the port 8000.

如果它的跨域策略错误的情况下,有没有人样的解释应该做些什么来解决这个问题?

If it's the case of the crossdomain policy error, is anyone kind to explain what should be done to fix the problem?

感谢您的关注。

更新1:

我建立了一个服务器侦听端口843给跨域文件,但我可以看到Flash不尝试加载它。 (我测试命令蟒蛇-c打印&LT;政策性文件的请求/&GT;%C0%|数控23.29.126.76 843 并检查如何策略服务器确实工作。

I set up a server listening on port 843 giving the crossdomain file, but I can see how Flash doesn't try to load it. (I tested the command python -c 'print "<policy-file-request/>%c" % 0' | nc 23.29.126.76 843 and checked how the policy server indeed works.

如何来的SWF不会尝试加载一个跨域策略文件?

推荐答案

哇。我刚刚看了这个就Socket.IO文档: 闪政策端口默认为10843

Whoa. I just read this on the Socket.IO documentation: "flash policy port defaults to 10843

默认情况下,Socket.IO客户端将检查服务器上的端口10843,看是否flashsocket连接被允许。 Adobe Flash播放器通常使用843作为默认的端口,但我们还是决定默认为无根端口。

By default the Socket.IO client will check port 10843 on your server to see if flashsocket connections are allowed. The Adobe Flash Player normally uses 843 as default port, but we decided to default to a non root port."

所以这就是为什么它没有试图从端口843加载文件...

So that's why it didn't try to load the file from port 843...

来源: https://github.com/LearnBoost/Socket。 IO /维基/ Configuring-Socket.IO

这篇关于如何解决使用Flash,Socket.IO和NodeJS这个(可能)跨域策略错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆