Changeset View
Changeset View
Standalone View
Standalone View
support/aphlict/server/aphlict_server.js
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| var http = require('http'); | var http = require('http'); | ||||
| process.on('uncaughtException', function(err) { | process.on('uncaughtException', function(err) { | ||||
| debug.log('\n<<< UNCAUGHT EXCEPTION! >>>\n' + err.stack); | debug.log('\n<<< UNCAUGHT EXCEPTION! >>>\n' + err.stack); | ||||
| process.exit(1); | process.exit(1); | ||||
| }); | }); | ||||
| var flash_server = new JX.AphlictFlashPolicyServer() | new JX.AphlictFlashPolicyServer() | ||||
| .setDebugLog(debug) | .setDebugLog(debug) | ||||
| .setAccessPort(config.port) | .setAccessPort(config.port) | ||||
| .start(); | .start(); | ||||
| var send_server = net.createServer(function(socket) { | net.createServer(function(socket) { | ||||
| var listener = clients.addListener(socket); | var listener = clients.addListener(socket); | ||||
| debug.log('<%s> Connected from %s', | debug.log('<%s> Connected from %s', | ||||
| listener.getDescription(), | listener.getDescription(), | ||||
| socket.remoteAddress); | socket.remoteAddress); | ||||
| var buffer = new Buffer([]); | var buffer = new Buffer([]); | ||||
| var length = 0; | var length = 0; | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
| }).listen(config.port); | }).listen(config.port); | ||||
| var messages_out = 0; | var messages_out = 0; | ||||
| var messages_in = 0; | var messages_in = 0; | ||||
| var start_time = new Date().getTime(); | var start_time = new Date().getTime(); | ||||
| var receive_server = http.createServer(function(request, response) { | http.createServer(function(request, response) { | ||||
| // Publishing a notification. | // Publishing a notification. | ||||
| if (request.url == '/') { | if (request.url == '/') { | ||||
| if (request.method == 'POST') { | if (request.method == 'POST') { | ||||
| var body = ''; | var body = ''; | ||||
| request.on('data', function(data) { | request.on('data', function(data) { | ||||
| body += data; | body += data; | ||||
| }); | }); | ||||
| ▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines | |||||