MVP: Two users chatting via embedded SPA #9
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/chat#9
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Two users should be able to open the embedded SPA web client in their browsers, create sessions, join a channel, and exchange messages in real-time.
What works today
GET /messages?after=ID)/join,/part,/msgcommandsWhat's missing for two-user chat
Backend
GET /messagescurrently returns immediately. Needs to hold the connection open for up to 15s (per README spec) when no messages are available, returning as soon as a new message arrives. Without this, the SPA polls on a fixed 1.5s interval which is wasteful and adds latency.sessionsandclientstables per the architecture.PollMessagesqueries the messages table directly. Need aclient_queuestable so each client gets its own delivery queue with independent cursors, per the multi-client spec.{id, nick, content, channel, ...}). Need to return IRC-style envelopes:{command: "PRIVMSG", from: "nick", to: "#channel", body: ["text"], id: "uuid", ts: "iso8601"}.{command: "JOIN", ...}etc., not just side-effects.POST /api/v1/nickor similar. Currently no way to change nick after session creation.POST /channels/{name}/topicand topic in channel info. SPA has no topic display.SPA Client
setInterval(poll, 1500)to recursive long-poll (GET /messages?after=ID&timeout=15). Immediately re-poll after receiving messages.{command, from, to, body}instead of{nick, content, channel}./nickcommand should work.Database Schema Changes
sessionstable (uuid, nick, signing_key, created_at, last_seen)clientstable (uuid, session_id, token, created_at, last_seen)client_queuestable (client_id, message_id) for per-client deliverymessage_typecolumn to messages (or switch to IRC command-based schema)Not needed for MVP
Acceptance criteria
User A and User B can:
#generalDesign clarification from sneak: All C2S commands go through
POST /messageswith thecommandfield. No separate routes for NICK, TOPIC, JOIN, PART, etc.Examples:
This means:
POST /channels/joinandDELETE /channels/{name}from the APIPOST /messagesbecomes the single C2S command endpoint — server dispatches bycommandfieldGET /messages(polling),GET /state,GET /history,GET /channels/all,GET /channels/{name}/members,GET /serveras read-only endpointsAPI Unified Command Endpoint
Pushed to
feature/web-client— all C2S commands now go throughPOST /api/v1/messageswith acommandfield:Changes
POST /messagesdispatches bycommandfield:PRIVMSG,JOIN,PART,NICK,TOPIC,PINGPOST /channels/join,DELETE /channels/{name},POST /register/register→/session,/channels/all→/channelsChangeNick,SetTopicThis simplifies the API surface significantly — the entire write path is one endpoint.
clawbot referenced this issue2026-02-11 03:03:11 +01:00
clawbot referenced this issue2026-02-11 09:50:32 +01:00