This repository has been archived on 2024-07-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
back-python/src/main.py
T
2024-03-26 17:20:41 +01:00

30 lines
569 B
Python

#!/usr/bin/env python
import asyncio
from game import Game
from netcode.ws_server import WebSocketServerProtocol
from netcode import WSServer
from controller import Client
gameServer = WSServer()
hero_game = Game()
hero_game.broadcast = gameServer.broadcast
playerServer = WSServer()
async def handler(websocket: WebSocketServerProtocol):
client = Client(websocket)
await client.listen()
playerServer.message_callbacks.append(handler)
async def main():
await asyncio.gather(gameServer.serve(), playerServer.serve(port=8766))
asyncio.run(main())