mirror of
https://github.com/webxoss/webxoss-core.git
synced 2024-11-20 06:49:53 +01:00
add https game server startup script
This commit is contained in:
parent
41cdea88f6
commit
c05ae82fe2
2 changed files with 21 additions and 2 deletions
21
test.js
21
test.js
|
@ -69,7 +69,26 @@ if (global.window) {
|
|||
server.listen(port);
|
||||
}
|
||||
// game server
|
||||
var gameServer = new require('http').createServer();
|
||||
var getArg = function (key) {
|
||||
var value = '';
|
||||
process.argv.slice(2).forEach(function (arg) {
|
||||
if (arg.indexOf(key + '=') === 0) {
|
||||
value = arg.replace(key + '=', '');
|
||||
}
|
||||
});
|
||||
return value;
|
||||
};
|
||||
var gameServer
|
||||
if (getArg('key')) {
|
||||
var fs = require('fs');
|
||||
gameServer = require('https').createServer({
|
||||
key: fs.readFileSync(getArg('key')),
|
||||
cert: fs.readFileSync(getArg('cert')),
|
||||
ca: fs.readFileSync(getArg('ca')),
|
||||
});
|
||||
} else {
|
||||
gameServer = require('http').createServer();
|
||||
}
|
||||
io = require('socket.io')(gameServer,{
|
||||
pingTimeout: 30000,
|
||||
maxHttpBufferSize: 1024*1024,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b69cfabd41cbea0059b03891f0a4c900fe2dbb09
|
||||
Subproject commit 4b1c84b47a1bc3efac902b792fb46b4e95151b4a
|
Loading…
Reference in a new issue