Skip to content

Commit

Permalink
remove unnecessary data filed from python client example
Browse files Browse the repository at this point in the history
  • Loading branch information
dancost committed Jul 23, 2024
1 parent 4c8680e commit 5eff196
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,20 @@ import websockets
async def main():
uri = "ws://127.0.0.1:8000/ws"
async with websockets.connect(uri) as websocket:
subscribe_message = json.dumps({"action": "subscribe", "data": {"channel": "all"}})
# Send subscription message for all orders
subscribe_message = json.dumps({"action": "subscribe"})
await websocket.send(subscribe_message)
print("Subscribed to all orders")
while True:
message = await websocket.recv()
print("Received:", json.loads(message))
try:
message = await websocket.recv()
print("Received:", json.loads(message))
except websockets.ConnectionClosed:
print("WebSocket connection closed")
break
if __name__ == "__main__":
asyncio.run(main())

0 comments on commit 5eff196

Please sign in to comment.