sync/server.js

23 lines
689 B
JavaScript
Raw Normal View History

2013-02-16 17:19:59 +00:00
/**
* Copyright 2013 Calvin 'calzoneman' Montgomery
*
* Licensed under Creative Commons Attribution-NonCommercial 3.0
* See http://creativecommons.org/licenses/by-nc/3.0/
*
*/
2013-02-16 05:02:42 +00:00
var Config = require('./config.js');
var connect = require('connect');
var app = connect.createServer(connect.static(__dirname+'/www')).listen(Config.IO_PORT);
exports.io = require('socket.io').listen(app);
var User = require('./user.js').User;
2013-03-06 22:02:40 +00:00
var Database = require('./database.js');
Database.init();
2013-02-16 05:02:42 +00:00
exports.channels = {};
exports.io.sockets.on('connection', function(socket) {
2013-02-16 05:02:42 +00:00
var user = new User(socket, socket.handshake.address.address);
console.log('New connection from /' + user.ip);
});