fix: refresh HTTP server

This commit is contained in:
cha0s 2019-04-20 21:36:17 -05:00
parent 1503cbb129
commit 6c00da70f9

View File

@ -2,19 +2,20 @@ import http from 'http';
import {Server} from '@avocado/server/socket';
// Import directly for HMR hierarchy.
import '../register-traits';
const httpServer = http.createServer();
// Start game server.
import Game from './game';
const avocadoServer = new Server(httpServer);
const avocadoServer = new Server();
let game;
let httpServer;
function createGame() {
game = new Game();
// Listen for connections.
httpServer = http.createServer();
httpServer.listen(8420, '0.0.0.0');
avocadoServer.on('connect', game.acceptConnection, game);
avocadoServer.open();
avocadoServer.open(httpServer);
}
function destroyGame(fn) {