按照我的代码创建服务器和策略文件服务器:
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app), fspfs = require('policyfile')
, fs = require('fs'), url = require('url');
flash = fspfs.createServer();
flash.listen(10081,app, function(){
console.log(':3 yay');
});
app.listen(3000);
在Flash上我初始化套接字,如, socket = new FlashSocket(“localhost:3000”); socket.addEventListener(FlashSocketEvent.CONNECT,onConnect); socket.addEventListener(FlashSocketEvent.MESSAGE,onMessage); socket.addEventListener(FlashSocketEvent.IO_ERROR,onError); socket.addEventListener(FlashSocketEvent.SECURITY_ERROR,onError);
当我运行应用程序时,我得到以下错误:
错误:无法从xmlsocket:// localhost:843
加载策略文件*** Security Sandbox Violation ***
Connection to localhost:3000 halted - not permitted from http://dev/FlashSockets_Demo-debug/FlashSockets_Demo.swf
Error: Request for resource at xmlsocket://localhost:3000 by requestor from http://dev/FlashSockets_Demo-debug/FlashSockets_Demo.swf is denied due to lack of policy file permissions.