feat: Add WebSocket support for real-time updates#1404
Open
knoxiboy wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Socket.IO-based real-time update propagation so the frontend can automatically refresh tasks/routines when changes occur on the backend.
Changes:
- Introduces Socket.IO server initialization and per-user “room” messaging on the backend.
- Adds a React
SocketProvider+SocketContexton the frontend to listen for update events and trigger refetches. - Updates routine/task UIs/hooks to refetch on
task-update/routine-updateticks.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/RoutineBuilder.jsx | Refetches routines when a socket-driven update tick changes. |
| frontend/src/pages/Dashboard.jsx | Refetches routines when a socket-driven update tick changes. |
| frontend/src/main.jsx | Wraps app in SocketProvider to enable socket context app-wide. |
| frontend/src/hooks/useTasks.js | Refetches tasks when a socket-driven update tick changes. |
| frontend/src/context/SocketContext.jsx | Adds Socket provider/context and client-side socket listeners. |
| frontend/package.json | Adds socket.io-client dependency. |
| backend/utils/socket.js | Adds Socket.IO server setup with basic CORS config and room-join event. |
| backend/src/server.js | Switches to HTTP server + initializes Socket.IO, then listens via server.listen. |
| backend/package.json | Adds socket.io dependency. |
| backend/controllers/taskController.js | Emits task-update to the user room on task mutations. |
| backend/controllers/routineController.js | Emits routine-update to the user room on routine mutations. |
Files not reviewed (2)
- backend/package-lock.json: Language not supported
- frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
🐞 Description
Resolves #1305.
This PR introduces Socket.IO-based real-time updates so the frontend can automatically refresh tasks and routines when changes occur on the backend, ensuring a seamless collaborative experience.
💻 Expected Behavior
outine-update\ events to trigger UI refetches.
🖼️ Screenshots / Logs (if applicable)
N/A
✅ Checklist