Repository navigation
feat(gateway): page history and forward typing - #105
Merged
Merged
Conversation
The ledger now holds the whole message log (newest 5000) instead of a 256 KB tail, so clients can page backwards with a history frame. A typing frame is forwarded to everyone else at most once every two seconds per handle.
A client could request history pages without limit; history now shares a bucket of ten requests refilled at two per second per handle. Startup reads at most the last 8 MB of each log instead of the whole file.
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.
The Universe client needs to scroll back through the lobby and to show who is typing; the gateway only sent the last 100 messages and knew no other client frames.
The ledger now loads the whole
messages.logandmessages.log.1(newest 5000 records) instead of a 256 KB tail. Two client frames are added:{"type":"history","before":"<id>","limit":N}answers{"type":"history","before":"<id>","messages":[oldest…newest],"more":bool}(limit clamped to 1…100, unknown id →error unknown_message), and{"type":"typing"}is forwarded to every other ready client as{"type":"typing","handle":"<sender>"}at most once per two seconds per handle.readystill carries the last 100 messages.Verified:
bun test(47 pass) andbunx tsc --noEmit; deployed to chat.m1ng.space on 2026-10-11 07:01 UTC (previous binary kept in /root), and the client paged back to the first message of the log.