This commit is contained in:
2016-02-13 00:42:38 +01:00
parent 4c20da7d65
commit 5b7fc52d7e
11 changed files with 335 additions and 72 deletions

View File

@@ -3,13 +3,12 @@
* @author frtk
*/
var VERSION = '0.0.5';
/**
* HTTP Service
*/
var HTTP = {
port: 8042,
var Config = {
VERSION : '0.0.8',
HTTP: {
host: '127.0.0.1',
port: 8042
},
}
@@ -20,6 +19,5 @@ var HTTP = {
*
*/
if (typeof exports !== "undefined") {
exports.HTTP = HTTP;
exports.VERSION = VERSION;
exports.Config = Config;
}

View File

@@ -10,13 +10,16 @@
* nodePong Server Object
*
*/
var Server = {
var NPGServer = {
/*
* Data
*/
// version
// app
version: '',
host: '',
port: 0,
// Users and Games
users: [],
games: [],
@@ -26,9 +29,12 @@ var Server = {
*
*/
//--- init()
init: function() {
init: function(o) {
var self = this;
self.version = o.VERSION || '';
self.host = o.HTTP.host || '';
self.port = o.HTTP.port || 8042;
self.log('$ ##### nodePong - v'+self.version);
},
@@ -37,10 +43,6 @@ var Server = {
this.version = s;
},
//--- setIO(io)
setIO: function(io) {
},
/*
* Server Messages
@@ -90,16 +92,14 @@ var Server = {
socketHandling: function(io) {
var self = this;
io.sockets.on('connection', function (socket) {
//
self.log('$ User connected : id=' + socket.id);
//
self.log('$ User connected : id=' + socket.id);
// 'disconnect'
socket.on('disconnect', function () {
self.log('$ User disconnected : id=' + socket.id);
connected = false;
});
// 'disconnect'
socket.on('disconnect', function () { self.log('$ User disconnected : id=' + socket.id);
});
//
});
},
@@ -135,7 +135,7 @@ var Game = function() {
*
*/
if (typeof exports !== "undefined") {
exports.Server = Server;
exports.NPGServer = NPGServer;
exports.User = User;
exports.Game = Game;
}