I have a basic mini game working with flash and node.js in my localhost, and I'm hoping to move the backend to a remote server. I've created an Amazon EC2 instance, installed node.js, npm and got it running and listening on port 1337. The thing is now I'm getting a sandbox security error in flash now. I'm using FlashDevelop and compiling with the "Use Network services" to true. I'm not sure how to handle the crossdomain.xml issue. Do I need to listen for a request within node.js for this specific file and output the contents?
My actionscript:
var host:String = "54.234.175.99";
Security.allowDomain(host);
Security.allowInsecureDomain(host);
Security.loadPolicyFile("xmlsocket://" + host + ":" + "1337");
xmlSocket = new XMLSocket(host, 1337);
xmlSocket.addEventListener(DataEvent.DATA, onData);
xmlSocket.addEventListener(Event.CONNECT, onConnect);
xmlSocket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
In node I'm using the net module for communication with flash via sockets:
var net = require('net');
var server = net.createServer(function(socket) {
socket.on("connect", function(client){
console.log('new flash client connected')
});
var data_buffer='';
socket.on('data', function(data) {
console.log('received data'+data);
// do stuff with data
});