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

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.

Prefer send() with a typed payload for images, audio, and documents. Use sendBinary() only when you need raw bytes without JSON structure β€” see Binary messaging.


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.

β†’ Large messages & chunking


Receiving structured payloads

In onMessage, branch on body.type:


Language guides

Language
Guide

JavaScript / TypeScript

Dart / Flutter


Last updated