mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
31 lines
843 B
JavaScript
31 lines
843 B
JavaScript
var Websocket = require('./websocket'),
|
|
net = require('net'),
|
|
listeners = [],
|
|
|
|
Flashsocket = module.exports = function(){};
|
|
|
|
sys.inherits(HTMLFile, Websocket);
|
|
|
|
Flashsocket.httpUpgrade = true;
|
|
|
|
Flashsocket.init = function(listener){
|
|
listeners.push(listener);
|
|
};
|
|
|
|
try {
|
|
net.createServer(function(socket){
|
|
socket.write('<?xml version="1.0"?>\n');
|
|
socket.write('<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n');
|
|
socket.write('<cross-domain-policy>\n');
|
|
|
|
listeners.forEach(function(l){
|
|
[].concat(l.options.origins).forEach(function(origin){
|
|
var parts = origin.split(':');
|
|
socket.write('<allow-access-from domain="' + parts[0] + '" to-ports="'+ parts[1] +'"/>\n');
|
|
});
|
|
});
|
|
|
|
socket.write('</cross-domain-policy>\n');
|
|
socket.end();
|
|
}).listen(843);
|
|
} catch(e){} |