mancala/src/index.ts
2022-07-15 21:44:16 +03:00

18 lines
683 B
TypeScript

import { RTMTWS } from "./rtmt/rtmt_websocket";
import { GameManager } from "./game/GameManager";
import { GameStoreImpl } from "./game/gamestore/GameStoreImpl";
import { MatchMakerImpl } from "./matchmaker/MatchMakerImpl";
import { ExpressApp } from "./server/ExpressApp";
import { WebServer } from "./server/WebServer";
const rtmt = new RTMTWS();
const gameStore = new GameStoreImpl();
const matchMaker = new MatchMakerImpl();
const gameManager = new GameManager({ rtmt, gameStore, matchMaker })
const expressApp = new ExpressApp();
const server = new WebServer({expressApp});
rtmt.initWebSocket(server.server, (userKey: string) => gameManager.fireOnPlayerConnected(userKey));