Skip to content

Add structured chat messages with channel-scoped client rendering - #295

Open
ann0see wants to merge 1 commit into
mainfrom
chat-redesign
Open

Add structured chat messages with channel-scoped client rendering#295
ann0see wants to merge 1 commit into
mainfrom
chat-redesign

Conversation

@ann0see

@ann0see ann0see commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the legacy free-text chat wire format (message 18, server-assembled HTML) with a structured, semantic chat protocol while keeping full backward compatibility:

  • Message 37 (MSG_CHAT_TEXT_CHANNEL) carries structured chat data: channelId, timestamp, senderName, text.
  • Capability negotiation: message 38 (REQ_CHAT_TEXT_SUPPORT) / 39 (CHAT_TEXT_SUPPORTED) lets the server detect clients that understand the new format and only send message 37 to them.
  • Server-side validation (message size limits, per-field length checks) before fan-out.
  • Client-side rendering: messages are rendered locally with per-channel colors and safe linkification. User text is HTML-escaped before any linkification, so user input can never be interpreted as markup.
  • JSON-RPC: jamulusserver/chatMessageReceived and jamulusclient/chatTextReceived now carry the structured {channelId, timestamp, senderName, text} payload instead of opaque HTML.

The old message 18 / server-HTML path is retained for legacy clients.

Tests

  • New tests/chatprotocol QtTest suite: 48 assertions covering round-tripping, reject rules (over-length, truncated, malformed), split/merge of large messages, capability negotiation, the ChatMessage data model, and safe-render security cases (script/img/bold injection, URL linkification).

Documentation

  • docs/JSON-RPC.md updated for the structured chat notifications (client and server).
  • docs/design-chat-redesign.md captures the design and decisions.

Introduces chat message type 37 carrying semantic chat data (channel id, timestamp, sender name, text) alongside the legacy message 18, negotiated via new REQ_CHAT_TEXT_SUPPORT / CHAT_TEXT_SUPPORTED messages (38/39). The server fans out structured chat to all clients and exposes it over JSON-RPC (jamulusserver/chatMessageReceived, jamulusclient/chatTextReceived). The client renders messages client-side with per-channel colors and safe linkification, escaping user text before any HTML interpretation.
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