fix: upgrade CLI to new backend API and WebSocket protocol - #5
Merged
Merged
Conversation
The backend API/WebSocket protocol changed, breaking the CLI. This commit
updates the CLI to work with the new spec.
WebSocket subscription model:
- Replace subscribe_server_room/unsubscribe_server_room with
subscribe_servers (per-server array subscription)
- TUI now subscribes to all user servers on WS connect
- Remove per-room unsubscribe (no longer in spec)
New WebSocket message types (server → client):
- FriendRequestDeclined, FriendRequestWithdrawn, FriendRemoved
- VoiceRoomUserSpeaking, ServerRoomCreated, ServerRoomDeleted
- UserStatusChanged, ServerMemberStatuses, ServerInviteReceived
- ServerSnapshot, RoomMessageEdited, RoomMessageDeleted, RoomTyping
- DmMessageEdited, DmMessageDeleted, UnreadCounts, UserGameActivity
New WebSocket message types (client → server):
- SetGameActivity, MarkRoomRead, MarkDmRead
REST API response format change:
- Message endpoints now return {"messages": [...], "hasMore", "nextCursor"}
instead of a bare array
- Add extract_messages() helper to handle both formats
- Update all 6 call sites (chat.rs, dms.rs, join.rs, tui/app.rs)
TUI message handlers:
- Friend decline/withdraw/remove trigger friend list reload
- RoomMessageEdited/DmMessageEdited update message content in place
- RoomMessageDeleted/DmMessageDeleted remove message from list
- ServerRoomCreated/Deleted trigger server detail refresh
- UnreadCounts populates dm_unread from payload
- Remaining new types log at debug level (no-op for now)
Bug fixes:
- Fix Ctrl+C/Esc not exiting chat open (return value was discarded)
- Unwrap nested "message" field in RoomMessage WS events
- Add raw WS logging to non-persistent connections for debugging
Other:
- Add --region flag to join command for voice server region selection
- Add unit tests for all new WS message types and serialization
- Clean clippy warnings
mooncitizen
force-pushed
the
fix/upgrade-the-cli-to-new-interactions
branch
from
March 27, 2026 16:26
3ddc43f to
19dbb7c
Compare
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
The backend API/WebSocket protocol changed, breaking the CLI. This commit updates the CLI to work with the new spec.
WebSocket subscription model:
New WebSocket message types (server → client):
New WebSocket message types (client → server):
REST API response format change:
TUI message handlers:
Bug fixes:
Other:
Changes
How to test
Checklist
cargo build --workspace)cargo test --workspace)