Commit 5d8de71b authored by Leo Iannacone's avatar Leo Iannacone

create objects only after listing event

parent 442a0e3c
......@@ -7,19 +7,9 @@ var express = require('express')
, routes = require('./routes')
, config = require('./lib/config.js')
, utils = require('./lib/utils.js')
, Client = require('./lib/client.js')
, Broadcaster = require('./lib/broadcaster.js')
var app = module.exports = express.createServer();
// no log
//var io = require('socket.io').listen(app, { log: false });
var io = require('socket.io').listen(app);
// statuses
var status = {}
status.packages = []
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
......@@ -46,19 +36,32 @@ app.get(config.routes.distribution, routes.distribution)
if (config.routes.preferences)
app.get(config.routes.preferences, routes.preferences)
var broadcast = new Broadcaster(io.sockets, status)
// Listening
var server = app.listen(config.port, config.host, null, function(){
var Client = require('./lib/client.js')
var Broadcaster = require('./lib/broadcaster.js')
// no log
//var io = require('socket.io').listen(app, { log: false });
var io = require('socket.io').listen(app);
io.sockets.on('connection', function(socket) {
client = new Client(socket)
// statuses
var status = {}
status.packages = []
var broadcast = new Broadcaster(io.sockets, status)
io.sockets.on('connection', function(socket) {
var client = new Client(socket)
client.start()
if (status.packages.length > 0)
client.send_status(status)
});
});
io.sockets.on('disconnect', function(socket){
io.sockets.on('disconnect', function(socket){
});
});
var server = app.listen(config.port, config.host, null, function(){
console.log("Debomatic-webui listening on %s:%d in %s mode", app.address().address, app.address().port, app.settings.env);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment