Files
DFJ/tasks/task_010.txt
2025-12-16 08:57:19 +08:00

12 lines
873 B
Plaintext

# Task ID: 10
# Title: WebSocket Client Integration & State Management
# Status: pending
# Dependencies: 1, 9
# Priority: high
# Description: Integrate WebSocket client logic into the Taro frontend. Implement global state management (Zustand) to store connection status and received game messages, ensuring real-time UI updates.
# Details:
Create a WebSocket service/hook in the frontend to manage connection lifecycle (connect, disconnect, send, receive). Use Zustand to create a `GameStore` that holds `connectionState`, `user`, `room`, `gameState`. Update UI based on changes in `GameStore`. Implement message parsing and dispatching to relevant parts of the application.
# Test Strategy:
Verify client can connect to WebSocket server. Send test messages from server and confirm client receives and updates state. Test reconnection logic (manual disconnect/reconnect).