optimized server starting, compatible for cloud9, added port as 2nd argument and socket.io log level as 3rd argv

This commit is contained in:
logsol 2012-07-16 00:04:06 +02:00
parent 3c1e7008e5
commit 48039054bb
2 changed files with 17 additions and 18 deletions

View file

@ -1,18 +1,21 @@
define(['socket.io'], function(io) {
function Socket(server, coordinator) {
function Socket(server, options, coordinator) {
options.logLevel = typeof options.logLevel != 'undefined'
? options.logLevel
: 0;
this.coordinator = coordinator;
this.socket = io.listen(server);
this.init(server);
this.init(options);
}
Socket.prototype.init = function(){
Socket.prototype.init = function(options){
var self = this;
this.socket.configure('development', function(){
this.set('log level', 0);
this.set('log level', options.logLevel);
});
this.socket.on('connection', function(user){
@ -26,4 +29,4 @@ define(['socket.io'], function(io) {
return Socket;
});
});