static serve(port) { if (!this.server) { const staticServer = new nodeStatic.Server(__dirname + '/../static'); this.server = http.createServer((request, response) => { request.on('end', () => staticServer.serve(request, response)).resume(); }).listen(port); if (this.io) { this.io.disconnect() || this.io.close(); } this.io = io.listen(this.server, { 'forceNew': true }); this.io.sockets.on('connection', this.onConnection.bind(this)); } return this.server; }