feat/enhance signal r #75
Merged
Rashed99Azm merged 1 commit intoJun 23, 2026
Merged
Conversation
…es counters per user
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.
SignalR Contract Improvements
Summary
This PR improves the realtime SignalR contract by reducing unnecessary client refetches and lowering traffic generated by ephemeral events. The goal is to make common UI updates render directly from SignalR payloads while keeping the implementation lightweight and avoiding the complexity of event replay infrastructure.
Changes
1. Enrich
NewReplyPayloadNewReplypreviously contained only identifiers:{ "postId": "...", "replyId": "...", "parentReplyId": "...", "depth": 1 }The event now includes the minimum data required for immediate rendering:
{ "postId": "...", "replyId": "...", "parentReplyId": "...", "depth": 1, "authorId": "...", "body": "...", "createdOn": "..." }Benefit: Clients can insert newly created replies without issuing an additional GET request.
2. Enrich
PollResultsChangedPayloadPollResultsChangedpreviously sent only poll and post identifiers, requiring clients to refetch poll results after every vote.The event now includes aggregated poll state:
{ "pollId": "...", "postId": "...", "totalVotes": 123, "options": [ { "id": "...", "count": 45 }, { "id": "...", "count": 78 } ] }Benefit: Clients can update poll results immediately without additional API calls.
3. Debounce
TypingChangedBroadcastsTyping notifications were previously broadcast on every typing action, producing unnecessary traffic in active discussions.
Typing broadcasts are now throttled/debounced per user and post, reducing duplicate events while preserving realtime UX.
Benefit: Lower SignalR traffic and reduced client update churn in busy threads.
4. Reconnect Recovery Strategy Documentation
Instead of introducing event envelopes, replay infrastructure, or
/syncendpoints, this PR formalizes the recommended reconnect behavior:Benefit: Maintains correctness after transient disconnects without introducing event stores, replay mechanisms, sequence tracking, or synchronization endpoints.
Impact
Future Considerations
Potential future enhancements include event envelopes (
eventId,occurredOn,version) and replay/synchronization endpoints if stronger delivery guarantees become necessary.