Go to file
hant cb4b955bca Implement Server-Sent Events (SSE) for real-time battle streaming
Redesign web battle system from buffered to streaming architecture:

Backend Changes:
- New SSEOutput class for real-time event streaming to clients
- GameSession::streamBattle() for SSE-based battle execution
- Enhanced Screen::delay() to support SSE timing and buffering modes
- New /api/game/battle-stream endpoint handling SSE connections

Frontend Changes:
- Enhanced sendInput() to detect battle command (input "1")
- New streamBattle() function using EventSource for SSE connections
- Real-time log display matching terminal experience
- Event handlers for start, message, complete, error events

Benefits:
✓ Real-time streaming instead of waiting for complete battle
✓ Web frontend experience identical to terminal
✓ Lightweight implementation without WebSocket
✓ Automatic browser reconnection support
✓ ANSI colors fully preserved
✓ Backward compatible for non-battle screens

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 10:50:30 +08:00
.idea Merge remote-tracking branch 'origin/main' 2025-12-05 09:39:28 +08:00
bin 法术 2025-12-02 23:13:38 +08:00
src Implement Server-Sent Events (SSE) for real-time battle streaming 2025-12-07 10:50:30 +08:00
test Implement Server-Sent Events (SSE) for real-time battle streaming 2025-12-07 10:50:30 +08:00
web Implement Server-Sent Events (SSE) for real-time battle streaming 2025-12-07 10:50:30 +08:00
.DS_Store first 2025-12-05 09:38:15 +08:00
.gitignore 技能优化 2025-12-05 17:38:10 +08:00
box.json first 2025-12-01 18:13:15 +08:00
build-phar.php first 2025-12-01 18:13:15 +08:00
build.sh first 2025-12-01 18:13:15 +08:00
composer.json 逻辑优化 2025-12-04 18:11:28 +08:00
composer.lock 逻辑优化 2025-12-04 18:11:28 +08:00
save.json Implement Server-Sent Events (SSE) for real-time battle streaming 2025-12-07 10:50:30 +08:00
start-server.sh first 2025-12-01 18:13:15 +08:00