I'm trying to serve inline flash policy file on port 3000, but with no luck.
I can not catch any callback from flash policy call (<policy-file-request/>\0
). And I don't know how to serve send policy file back to flash through the socket.
Somethig like this: Setting up a socket policy file server from Adobe
This is code from server:
var server = require('http').createServer();
var io = require('socket.io')(server);
var port = 3000;
var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM \n"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">\n<cross-domain-policy>\n';
xml += '<site-control permitted-cross-domain-policies="master-only"/>\n';
xml += '<allow-access-from domain="*" to-ports="*"/>\n';
xml += '</cross-domain-policy>\n';
io.on('connection', function (socket) {
socket.on('<policy-file-request/>\0', function (data, callback) {
console.log('socket policy-file-request 0');
callback(xml);
});
});
server.listen(port, function () {
info('Server listening at ' + port);
});
And from client:
Security.loadPolicyFile("xmlsocket://example.com:3000");
You are doing the socket.io connections and communications incorrectly. You have to emit to the sockets instead of using a callback method, as such (a modification of your code):
Server:
Client: