dataflow.api.simple_chess_ws¶

Simple WebSocket server for streaming chess game state.

Functions¶

get_empty_board()

Create a new chess board in starting position.

get_game_state(game_id)

Get the current game state.

get_html()

Serve the HTML client.

main()

Run the WebSocket server.

make_random_move(board)

Make a random legal move.

websocket_endpoint(websocket, game_id)

WebSocket endpoint for chess games.

Module Contents¶

dataflow.api.simple_chess_ws.get_empty_board()¶

Create a new chess board in starting position.

dataflow.api.simple_chess_ws.get_game_state(game_id)¶

Get the current game state.

async dataflow.api.simple_chess_ws.get_html()¶

Serve the HTML client.

dataflow.api.simple_chess_ws.main()¶

Run the WebSocket server.

dataflow.api.simple_chess_ws.make_random_move(board)¶

Make a random legal move.

async dataflow.api.simple_chess_ws.websocket_endpoint(websocket, game_id)¶

WebSocket endpoint for chess games.

Parameters:
  • websocket (fastapi.WebSocket)

  • game_id (str)