При изменении порта в config.js в ошибке null:8088 тоже меняется.
Ошибка:Error: bind EADDRINUSE null:8088
at listenOnMasterHandle (net.js:1353:16)
at shared (internal/cluster/child.js:116:3)
at Worker.send (internal/cluster/child.js:87:7)
at process.onInternalMessage (internal/cluster/utils.js:42:8)
at process.emit (events.js:187:15)
at emit (internal/child_process.js:812:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at listenOnMasterHandle (net.js:1354:21)
at shared (internal/cluster/child.js:116:3)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:63:19)
rcon.js:module.exports = () => {
const cluster = require('cluster');
const Rcon = require('rcon');
if(cluster.isMaster) {
cluster.fork();
cluster.on('exit', () => {
setTimeout(() => cluster.fork(), 10*1000);
});
} else {
let rconCon = new Rcon('localhost', 25575, '12341');
rconCon.on('auth', function() {
console.log("[Website(rcon)] Rcon connection created");
})
.on('response', function(data) {})
.on('end', function() {
console.log("[Website(rcon)] Socket closed!");
});
rconCon.connect();
}
};
Server.js:var cfg = require('./config.js');
const express = require('express');
var app = express();
var server = require('http').Server(app);
var io = require('socket.io')(server);
app.use('/dist', express.static(__dirname + '/dist'));
// routes
app.all('/*', (req, res) => {
res.sendFile(__dirname + '/index.html');
});
server.listen(cfg.httpPort, () => console.log('[Website] Http server started!'));
//rcon
const rcon = require('./rcon.js')();
// feedback online
var feedback = io.of('/fb');
config.js:module.exports = {
rcon:{
},
httpPort: 8088,
}