mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
optimized server starting, compatible for cloud9, added port as 2nd argument and socket.io log level as 3rd argv
This commit is contained in:
parent
3c1e7008e5
commit
48039054bb
2 changed files with 17 additions and 18 deletions
|
|
@ -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;
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue