/**
 * User: Marius
 * Date: 14.02.2015
 * Time: 10:59
 */

var KSC = require("./ksc");
var log = require("./logging");
var WebSocketServer = require("./socketServer");

var finalhandler = require('finalhandler');
var serveStatic = require("serve-static");
var http = require("http");

var serve = serveStatic("web_root", {
    "index": ["index.html"]
});

var socketServer = new WebSocketServer();

var kscListener = new KSC("ksc");
kscListener.onData(function (data)
                   {
                       log.info("Sending data...");

                       socketServer.sendToAll(JSON.stringify(data));
                   });

var server = http.createServer(function (req, res)
                               {
                                   var done = finalhandler(req, res);
                                   serve(req, res, done);
                               });

var httpPort = process.env.PORT || 8080;

// Start the various servers and listeners
kscListener.start();
socketServer.open(httpPort);
server.listen(8080);

process.on('SIGINT', function ()
{
    console.log("\nGracefully shutting down from SIGINT (Ctrl-C)");

    server.close();
    socketServer.close();
    kscListener.stop();

    process.exit();
});

@@ -1001,24 +1001,20 @@
 er.open(
-httpPort
+8070
 );%0Aserve
@@ -1022,20 +1022,24 @@
 .listen(
-8080
+httpPort
 );%0A%0Aproc

Use the port for the right server...