Structured payloads (image, audio, doc)
Send rich media and file attachments through send() using typed data objects. The SDK serializes your payload, chunks large content automatically, and delivers a complete message to onMessage.
Recommended payload types
data.type
Typical fields
Use case
text
text
Chat messages
image
content (bytes)
Photo sharing
audio
content, durationMs
Voice notes
doc
content, fileName, mimeType
File attachments
DNotifier does not enforce a fixed enum β define conventions in your app and handle them in onMessage.
Sending flow
read file bytes locally
β
βΌ
send({ data: { type: "image", content: bytes } })
β
βΌ
SDK chunks if > messageSizeLimit
β
βΌ
receiver onMessage β payload.toJSON() or raw()Large files are split automatically. Your handler always receives a reassembled payload.
Receiving structured payloads
In onMessage, branch on body.type:
Language guides
Language
Guide
JavaScript / TypeScript
Dart / Flutter
Related topics
Chat UI patterns β rendering media in bubbles
Last updated