Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Chat UI patterns

DNotifier delivers messages and history APIs β€” your app owns the conversation UI. This page collects common patterns for threads, bubbles, media, and ephemeral signals.


Thread list

Maintain a list of conversations in your backend or derive from known peer IDs:

Field
Source

Peer user ID

Your user directory

Last message preview

Latest from history or local cache

Unread count

Your app tracks last read timestamp per thread

Avatar / display name

Your user profile service

DNotifier does not provide a thread-list API β€” you map userId pairs to UI rows.


Message bubbles

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Thread: Chat with Bob       β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚  ← incoming (peer)
  β”‚         β”‚ Hello!       β”‚    β”‚
  β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
  β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚  ← outgoing (self)
  β”‚    β”‚ Hi there     β”‚         β”‚
  β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚ [ Type a message...    ] ➀  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Align bubbles by comparing metadata.sender to the current user's prefixed id.


Message types in UI

data.type

UI treatment

text

Text bubble

image

Thumbnail + tap to expand

audio

Play button + duration

doc

File icon + download

typing

Subtle indicator, no bubble

message-deleted

Remove row from list

β†’ Structured payloads


Optimistic send

Show the outgoing message immediately, then reconcile:

  1. Append local message with status: "sending"

  2. await send(...)

  3. Update with metadata.id from any server acknowledgment or mark status: "sent"

  4. On failure, mark status: "failed" with retry


Typing indicators

Send ephemeral payloads with saveHistory: false:

Debounce in the input handler β€” do not send on every keystroke.


Scroll and load

Pattern
Implementation

Open thread

fetchChatHistory β†’ render β†’ scroll to bottom

New live message

Append in onMessage β†’ scroll if user near bottom

Pull to refresh

Refetch history and merge by id


Offline state

State
UI

Connected

Normal input enabled

Disconnected

Banner + disable send; queue optional

Reconnecting

Spinner on banner

β†’ Error handling & reconnection


Read state

DNotifier does not provide built-in read receipts. Implement with:

  • send({ type: "read", lastReadId }) with saveHistory: false, or

  • Your backend tracking read cursor per thread


Accessibility

  • Label send button and message list for screen readers

  • Provide alt text for image messages

  • Ensure sufficient color contrast for incoming vs outgoing bubbles


Last updated