feat(backend): WebSocket endpoint for real-time indexing progress (#149)#150
Merged
DevanshuNEU merged 4 commits intoJan 5, 2026
Conversation
…enCodeIntel#149) - Add /api/v1/ws/playground/{job_id} WebSocket endpoint - Implement Redis Pub/Sub for real-time event streaming - Publish events: connected, cloning, progress, completed, error - Progress events include current_file for streaming file list - Skip duplicate PROCESSING events (handled by update_progress) - Add comprehensive test suite (7 tests) Closes OpenCodeIntel#149
|
@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel. A member of the Team first needs to authorize it. |
- Fix: Must accept() before close() - was causing runtime errors - Fix: Check job exists before subscribing (return 4404) - Fix: Handle race condition - job may complete before WS connects - Fix: Remove unused INITIAL_TIMEOUT_SECONDS constant - Add: Idle timeout (120s) to prevent zombie connections - Add: 6 new tests for edge cases (13 total) Review by CTO caught these before production 🙏
- Test creates real indexing job and connects via WebSocket - Verifies full event flow: connected → progress → completed - Tests against zustand repo (47 files, ~1182 functions) - Confirms real-time streaming works end-to-end Tested manually - all events received correctly
The WebSocket E2E test requires: - Running server - Redis - aiohttp (not in CI deps) Moving to scripts/manual_ws_test.py so pytest doesn't collect it. Unit tests in test_ws_playground.py still run in CI (13 tests).
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
DevanshuNEU
added a commit
to DevanshuNEU/opencodeintel-fork-new
that referenced
this pull request
Jan 5, 2026
) 🚀 Features: - useIndexingWebSocket hook with auto-reconnect & polling fallback - Streaming file list - shows files appearing in real-time - Enhanced IndexingProgress with phase indicators & glow effects - IndexingComplete celebration screen with confetti & animated stats - Integrated WebSocket into HeroPlayground component 📁 Files: - NEW: hooks/useIndexingWebSocket.ts (WebSocket state machine) - NEW: components/playground/IndexingComplete.tsx (celebration UI) - UPDATED: components/playground/IndexingProgress.tsx (streaming file list) - UPDATED: components/playground/HeroPlayground.tsx (WS integration) - UPDATED: components/playground/index.ts (exports) 🎨 UX Highlights: - Files stream in real-time as they're processed - Phase indicator: Clone → Index → Done - Glowing progress bar - Confetti on completion - Animated stat counters Connects to backend WebSocket endpoint from PR OpenCodeIntel#150
This was referenced Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds WebSocket support for real-time indexing progress in the playground. Instead of polling every 2 seconds, the frontend can now subscribe to a WebSocket and receive instant updates as each file is processed.
Changes
New Files
backend/routes/ws_playground.py- WebSocket endpoint handlerbackend/tests/test_ws_playground.py- Test suite (7 tests)Modified Files
backend/main.py- Register new WS routebackend/services/anonymous_indexer.py- Add Redis Pub/Sub publishingEndpoint
Event Types
{"type": "connected", "job_id": "...", "message": "Listening for indexing events"} {"type": "cloning", "repo_name": "flask", "message": "Cloning repository..."} {"type": "progress", "files_processed": 25, "files_total": 100, "current_file": "src/app.py", "functions_found": 150, "percent": 25} {"type": "completed", "repo_id": "anon_xxx", "stats": {...}, "message": "Indexing complete!"} {"type": "error", "error": "clone_failed", "message": "...", "recoverable": false}Architecture
Tests
All 7 tests passing:
Why WebSocket over Polling?
The killer feature is the streaming file list - showing each file as it's processed in real-time. Polling every 2 seconds can't deliver that smooth experience. For the HN launch demo, this creates the "watching the AI work" moment.
Closes #149