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

Send & receive text

The core realtime pattern is send a JSON payload to a receiver ID and handle incoming messages in onMessage. This hub covers the concept; language pages have complete examples.


The send() contract

Field
Required
Description

senderId

Yes

Must match the connecting user's userId

receiverId

One of

Single recipient user ID

receiverIds

One of

Multiple recipients (see Multiple receivers)

data

Yes

JSON-serializable payload β€” typically { type: "text", text: "..." }

saveHistory

No

Default true β€” persist for chat history APIs

Example payload:

{
  "type": "text",
  "text": "Hello from DNotifier!"
}

Use any type string your app understands. DNotifier does not enforce a fixed enum.


Receiving messages

Register onMessage when constructing the client:

Each message includes:

  • metadata β€” sender, timestamp, id, type

  • payload β€” body with toJSON(), toString(), raw(), toBase64()

β†’ Understanding messages


Requirements

  • transport: "ws" β€” realtime send/receive uses WebSocket

  • connect() completed β€” isConnected must be true

  • Matching appId β€” sender and receiver must use the same application


Language guides

Language
Guide

JavaScript / TypeScript

Dart / Flutter


Topic
Link

First message walkthrough

Structured media

Multiple recipients

Building chat

Last updated