UMIX/86 - the chat system

One room, two ways in: the terminal CHAT command and the HTTP chat API. Both share one history ring and see each other's lines.

Terminal chat

USERID: CHAT
NICKNAME: BOB
BOB> hello
/WHO      list users (terminals + web nicknames)
/QUIT     leave

Joining and leaving post NICK: JOINED CHAT / NICK: LEFT CHAT into the shared history, so browser clients see presence too.

HTTP chat

POST /api/chat/join     {"nick":"ALICE"}        -> {"token":1}
POST /api/chat/send     {"token":1,"text":"hi"} -> {"seq":4}
GET  /api/chat/messages                          all retained
GET  /api/chat/messages/3                        only seq > 3
DELETE /api/chat/join/1                          leave
GET  /api/chat                                   nicks + api + latest

Nicknames are 2..9 alphanumeric chars, upcased; SYSOP is reserved. Text is 50 chars max; controls and quotes are stripped. The ring keeps the last 16 lines with 16-bit sequence numbers, so a browser polls messages/<last-seq>. Join announces the nickname; leave announces departure.

Controls and limits

This page is served by the guest through the PC bridge on 8080; if it loaded, the ring and the web task are healthy.