feat(realtime): typed event contract, rate limiting, heartbeat + notifications listing - #1117
Merged
Akanimoh12 merged 1 commit intoJul 25, 2026
Conversation
|
@codeX-james Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
3 tasks
Owner
|
Please resolve so I can merge please |
…heartbeat config + docs - Add a shared typed contract for Socket.IO events and payloads (SocketData, connected/error events) so client and server agree on shapes. - Reuse the REST module's verifyAccessToken for the socket auth handshake instead of duplicating JWT verification. - Throttle new connections per IP and client events per socket with a small in-memory sliding-window limiter; emit a typed RATE_LIMITED error. - Configure explicit pingInterval/pingTimeout for heartbeat detection and document heartbeat + client reconnection behavior in docs/REALTIME.md. - Wire initRealtime(httpServer) into server.ts — it was implemented but never actually started. - Remove a duplicate, unwired realtime.* implementation left over from a prior merge and consolidate on the one already used by tips.controller.ts. - Fix duplicate import/enum/model-field blocks in app.ts, schema.prisma, and AppError.ts (merge artifacts) that broke `tsc`/`prisma generate` repo-wide. The notifications listing endpoint (GET /notifications, paginated) was already fully implemented and tested on this branch; no changes needed. Closes Akanimoh12#954 Closes Akanimoh12#955 Closes Akanimoh12#956 Closes Akanimoh12#959
codeX-james
force-pushed
the
feat/realtime-notifications-954-955-956-959
branch
from
July 25, 2026 13:41
7fe57c7 to
c905c46
Compare
Akanimoh12
merged commit Jul 25, 2026
4662b76
into
Akanimoh12:test-implement-drips
4 of 5 checks passed
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
Resolves four assigned backend issues:
RATE_LIMITEDerror emitted back to the client.pingInterval/pingTimeouton the Socket.IO server and documented heartbeat + client reconnection behavior inbackend/docs/REALTIME.md.src/realtime/types.tsinto the single typed contract for both sides:ServerToClientEvents,ClientToServerEvents,SocketData, including previously-untypedconnected/errorevents (the old code used(socket as any).emit('error', ...)).GET /notifications(list, paginated). Already fully implemented and tested ontest-implement-drips; verified and left as-is.Consolidation note
src/realtime/had two parallel, divergent gateway implementations left over from prior merges (gateway.ts/auth.ts/types.ts, wired totips.controller.tsviaindex.ts, vs. an unwiredrealtime.gateway.ts/realtime.auth.ts/realtime.types.ts). Kept the wired set as canonical, folded over the better ideas from the other (reusing the REST module'sverifyAccessTokeninstead of duplicating JWT logic, graceful-shutdown registration), and deleted the dead duplicate. Also discoveredinitRealtime(httpServer)was implemented but never called —server.tshad it commented out — so realtime was effectively inert; it's now wired up.Unrelated build-blocking fixes
While verifying
npm run typecheck, found merge-artifact duplication (duplicate imports/enum/model fields) inapp.ts,prisma/schema.prisma, andAppError.tsthat broketscandprisma generatefor the whole repo, not just these modules. Fixed those (mechanical dedup only, no behavior change) since nothing else could be verified without it.Test plan
npm run typecheck— clean except one pre-existing, unrelated error insrc/modules/x/x.test.tsnpm run lint— 0 errors (3 pre-existing warnings elsewhere, untouched files)npm run test— allsrc/realtime/*andsrc/modules/notifications/*tests pass (27/27); other DB-backed integration suites (tips/auth/indexer/x) are unaffected by this change but require a local Postgres to runCloses #954
Closes #955
Closes #956
Closes #959