-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 32ba09c
Showing
5 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] } ); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |