diff --git a/Game_server/server.py b/Game_server/server.py index 3210df5..9177ca0 100644 --- a/Game_server/server.py +++ b/Game_server/server.py @@ -283,6 +283,18 @@ def print_active_games(): @sio.event async def connect(sid, environ): logging.info(f'Client connected: {sid}, Path: {environ.get("PATH_INFO")}') + + json_data = { + "type": "game_defaults", + "PADDLE_WIDTH": PADDLE_WIDTH, + "PADDLE_DEPTH": PADDLE_DEPTH, + "BALL_RADIUS": BALL_RADIUS, + "BALL_SPEED": BALL_SPEED, + "PADDLE_SPEED": PADDLE_SPEED + } + + for sid in self.sids: + await sio.emit('game_defaults', json_data, room=sid) # Event handler for disconnections # This function is called when a client disconnects from the server