mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
29 lines
No EOL
526 B
JavaScript
29 lines
No EOL
526 B
JavaScript
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;
|
|
|
|
}); |