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:
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
Optimistic send
Show the outgoing message immediately, then reconcile:
Append local message with
status: "sending"await send(...)Update with
metadata.idfrom any server acknowledgment or markstatus: "sent"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
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
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 })withsaveHistory: false, orYour 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
Related topics
Last updated