MCPcopy Index your code
hub / github.com/python-websockets/websockets / replay

Function replay

example/tutorial/step2/app.py:29–45  ·  view source on GitHub ↗

Send previous moves.

(websocket, game)

Source from the content-addressed store, hash-verified

27
28
29async def replay(websocket, game):
30 """
31 Send previous moves.
32
33 """
34 # Make a copy to avoid an exception if game.moves changes while iteration
35 # is in progress. If a move is played while replay is running, moves will
36 # be sent out of order but each move will be sent once and eventually the
37 # UI will be consistent.
38 for player, column, row in game.moves.copy():
39 event = {
40 "type": "play",
41 "player": player,
42 "column": column,
43 "row": row,
44 }
45 await websocket.send(json.dumps(event))
46
47
48async def play(websocket, game, player, connected):

Callers 2

joinFunction · 0.70
watchFunction · 0.70

Calls 2

copyMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…