Commit 96bea022 authored by Leo Iannacone's avatar Leo Iannacone

handling get packages

parent 7dcaf7ac
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
var express = require('express') var express = require('express')
, routes = require('./routes') , routes = require('./routes')
, config = require('./config.js') , config = require('./config.js')
, send = require('./send.js')() , send = require('./send.js')
, fs = require('fs') , fs = require('fs')
var app = module.exports = express.createServer(); var app = module.exports = express.createServer();
...@@ -36,10 +36,9 @@ var io = require('socket.io').listen(app); ...@@ -36,10 +36,9 @@ var io = require('socket.io').listen(app);
app.get('/', routes.index); app.get('/', routes.index);
io.sockets.on('connection', function(socket) { io.sockets.on('connection', function(socket) {
send.distributions(io.sockets); send.distributions(socket);
socket.on('get-distribution', function(from, distro) { socket.on('get-packages', function(distro) {
console.log(from + " " + distro) send.packages_list(socket, distro);
send.distribution(from, distro);
}); });
}); });
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
function get_path(path) { function get_path(path) {
info = path.split('/'); info = path.split('/');
if (info.length == 1) { if (info.length == 1) {
socket.emit("get-distribution", path); socket.emit("get-packages", path);
} }
} }
var socket = io.connect('//localhost:3000'); var socket = io.connect('//localhost:3000');
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
}); });
}); });
socket.on('packages', function(packages) {
console.log("HHHH");
console.log(packages);
});
socket.on('error', function() { console.error(arguments) }); socket.on('error', function() { console.error(arguments) });
$(window).on('hashchange', function() { $(window).on('hashchange', function() {
......
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