Repository navigation
Push a read event when a message is marked read - #55
Merged
Merged
Conversation
POST /fmsg/:id/read now notifies msg_read the first time a message becomes read, and the hub pushes a `read` event, carrying the message with its read state, to all of the reader's WebSocket connections. A client open in another tab or on another device can then stop showing the message as unread instead of waiting for a reload. The hub's channel switch moves into route so routing is unit tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
When a message is marked read, the reader's other tabs and devices learn about it over the WebSocket instead of showing it unread until they reload.
POST /fmsg/:id/readrunspg_notify('msg_read', '<id>,<reader>')the first time the message becomes read (not on repeat reads). This needs no schema change.LISTENs onmsg_readand pushes{"type":"read","data":<message with read/time_read>}to the reader's connections.route(ctx, channel, msgID, addr)so routing can be unit tested; behaviour is unchanged for the existing channels.readevent to the WebSocket events table, with a note underPOST /fmsg/:id/read.Tests:
TestHubRoute_MsgReadPushesReadEvent(unit) andTestMarkReadNotifies(integration: one notification with the right payload; none on a repeat read). The full handler suite passes against Postgres 17.Clients that don't know the
readtype ignore it, per the envelope contract.🤖 Generated with Claude Code