forked from mirrors/webxoss-core
splite backend
This commit is contained in:
parent
da5cb0b528
commit
41cdea88f6
2 changed files with 31 additions and 22 deletions
17
test.js
17
test.js
|
@ -42,6 +42,11 @@ if (global.window) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
var noStaticServe = process.argv.slice(2).some(function (arg) {
|
||||||
|
return arg === '--no-static-server';
|
||||||
|
});
|
||||||
|
// static server
|
||||||
|
if (!noStaticServe) {
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var compression = require('compression');
|
var compression = require('compression');
|
||||||
var app = express();
|
var app = express();
|
||||||
|
@ -54,10 +59,6 @@ if (global.window) {
|
||||||
maxAge: '30d'
|
maxAge: '30d'
|
||||||
}));
|
}));
|
||||||
app.use(express.static(__dirname + '/webxoss-client'));
|
app.use(express.static(__dirname + '/webxoss-client'));
|
||||||
io = require('socket.io')(server,{
|
|
||||||
pingTimeout: 30000,
|
|
||||||
maxHttpBufferSize: 1024*1024,
|
|
||||||
});
|
|
||||||
var port = 80;
|
var port = 80;
|
||||||
process.argv.slice(2).forEach(function (arg) {
|
process.argv.slice(2).forEach(function (arg) {
|
||||||
var match = arg.match(/^port=(\d+)/)
|
var match = arg.match(/^port=(\d+)/)
|
||||||
|
@ -67,6 +68,14 @@ if (global.window) {
|
||||||
});
|
});
|
||||||
server.listen(port);
|
server.listen(port);
|
||||||
}
|
}
|
||||||
|
// game server
|
||||||
|
var gameServer = new require('http').createServer();
|
||||||
|
io = require('socket.io')(gameServer,{
|
||||||
|
pingTimeout: 30000,
|
||||||
|
maxHttpBufferSize: 1024*1024,
|
||||||
|
});
|
||||||
|
gameServer.listen(2015);
|
||||||
|
}
|
||||||
|
|
||||||
var cfg = {
|
var cfg = {
|
||||||
MAX_ROOMS: 100,
|
MAX_ROOMS: 100,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5bd921d1ee0257ed2eea4db66e821f72db8f26ae
|
Subproject commit b69cfabd41cbea0059b03891f0a4c900fe2dbb09
|
Loading…
Reference in a new issue