Skip to content

feat(gateway): page history and forward typing - #105

Merged
m1ngsama merged 2 commits into
mainfrom
feat/gateway-history-typing
Oct 11, 2026
Merged

m1ngsama merged 2 commits into
mainfrom
feat/gateway-history-typing

Conversation

@m1ngsama

Copy link
Copy Markdown
Owner

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.log and messages.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. ready still carries the last 100 messages.

Verified: bun test (47 pass) and bunx 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.

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.
@m1ngsama
m1ngsama merged commit eccafbb into main Oct 11, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant