mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
moved files towards new structure. fixes #22
This commit is contained in:
parent
8cf8f057bb
commit
9de3147406
40 changed files with 0 additions and 110 deletions
32
app/bootstrap/Socket.js
Normal file
32
app/bootstrap/Socket.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
define(['socket.io'], function(io) {
|
||||
|
||||
function Socket(server, options, coordinator) {
|
||||
options.logLevel = typeof options.logLevel != 'undefined'
|
||||
? options.logLevel
|
||||
: 0;
|
||||
|
||||
this.coordinator = coordinator;
|
||||
this.socket = io.listen(server);
|
||||
|
||||
this.init(options);
|
||||
}
|
||||
|
||||
Socket.prototype.init = function(options){
|
||||
|
||||
var self = this;
|
||||
this.socket.configure('development', function(){
|
||||
this.set('log level', options.logLevel);
|
||||
});
|
||||
|
||||
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