Skip to content

Commit

Permalink
Last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadhight committed Jan 12, 2014
0 parents commit 32ba09c
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 0 deletions.
49 changes: 49 additions & 0 deletions HabboCI/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function ThreadsModule (config, server){

var System = require('os'),
Sockets = require('socket.io');

var Threads = {
"Relase": "Threads",
"Base": "22582",
"Version": "0.0.1",
"Status": "OK",
};

LoggerHandler('\n Threads.JS application handler');
LoggerHandler('Relase:' + Threads['Relase'] + ' status: ' + Threads['Status'] + ' version: ' + Threads['Version'] + ' kernel base: ' + Threads['Base']);
LoggerHandler('Server start: environment is: ' + config['environment'] + ' Listening connection on the port: ' + config['local']['port']);
LoggerHandler('Operating system: ' + System.type() + ' platform: ' + System.platform() + '\n');

var SocketIO = Sockets.listen(server, { origins: 'http://' + config['local']['host'] + ':*' });

setTimeout(function(){
var Io = require('./io.js')(SocketIO);
}, 2000);
};

function LoggerHandler (append, level){

var Colors = [
'\033[0m',
'\033[31m',
'\033[34m',
];

switch(level){
default:
console.log(' ' + Colors[0] + append);
break;

case "error":
return console.log(' ' + Colors[1] + '[ERROR] ' + Colors[0] + append);
break;

case "debug":
return console.log(' ' + Colors[2] + '[DEBUG] ' + Colors[0] + append);
break;
}
};

exports.Initializer = ThreadsModule;
exports.Logger = LoggerHandler;
13 changes: 13 additions & 0 deletions HabboCI/io.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var Application = require('./app');

module.exports = function(Io){

Application.Logger('SocketIO routers loaded!', 'debug');

Io.sockets.on('connection', function(Handshake){

Handshake.on('Mundoci::AlfaNotify', function(data){
Io.sockets.emit('Mundoci::Mandow', { username: data['userNotify'] } );
});
});
};
17 changes: 17 additions & 0 deletions Settings/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"Project": "MyGame",
"environment": "dev",

"local": {
"host": "localhost",
"port": 3002,
"limit": 1
},

"database": {
"host": "localhost",
"port": 3306,
"user": "root",
"password": "12341"
}
}
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Theards",
"description": "This server is created across node.js and with the library sockets.io for the game exclusive Mundoci",
"private": true,
"version": "0.0.1",
"author": "MettoK © 2013 - 2014",
"dependencies": {
"socket.io": "~0.9.16",
"express": "~3.4.0",
},
}
22 changes: 22 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Copyright 2013 - 2014 (C) All rights reserved
This program is private: you can not redistribute or sell.
Threads is a application for the game Mundoci and use the latest technologies that are on the web.
Powered by: MettoK
*/

var Config = require('./Settings/config'),
Server = require('http').createServer().listen(Config['local']['port']),
SyS = require('os');

Mundoci = require('./HabboCI/app');
Mundoci.Initializer(Config, Server);

setInterval(function(){
Mundoci.Logger('System timestamp: ' + SyS.uptime(), 'debug');
Mundoci.Logger('System CPU load: ' + SyS.loadavg()[0], 'debug');
Mundoci.Logger('System CPU total: ' + SyS.totalmem(), 'debug');
}, 50000);

0 comments on commit 32ba09c

Please sign in to comment.