mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
Added communication structure
This commit is contained in:
parent
980af70259
commit
94f63fc7b2
10 changed files with 292 additions and 129 deletions
29
lib/Server/Socket.js
Normal file
29
lib/Server/Socket.js
Normal 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;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue