Added communication structure

This commit is contained in:
logsol 2012-07-08 01:37:53 +02:00
parent 980af70259
commit 94f63fc7b2
10 changed files with 292 additions and 129 deletions

29
lib/Server/Socket.js Normal file
View file

@ -0,0 +1,29 @@
define(['socket.io'], function(io) {
function Socket(server, coordinator) {
this.coordinator = coordinator;
this.socket = io.listen(server);
this.init(server);
}
Socket.prototype.init = function(){
var self = this;
this.socket.configure('development', function(){
this.set('log level', 0);
});
this.socket.on('connection', function(user){
self.onConnection(user);
});
}
Socket.prototype.onConnection = function(socketLink){
this.coordinator.createUser(socketLink);
}
return Socket;
});