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

Overview

Realtime communication is DNotifier's directed messaging layer: clients connect over WebSocket, send payloads to explicit receiver IDs, and receive deliveries in onMessage. It is the foundation for chat, live dashboards, notifications, and backend-to-client updates.


What you get

Capability
API
Transport

Text and structured messages

send()

WebSocket (ws)

Multiple recipients

send({ receiverIds })

WebSocket

Images, audio, documents

send() with typed data

WebSocket

Raw binary frames

sendBinary()

WebSocket

Large payloads

Automatic chunking in SDK

WebSocket

Plan quotas

getPlanLimits(), messageSizeLimit

After connect()

For AI, RAG, and workflows, use transport: "http" β€” those APIs are not the focus of this section.


How messaging works

  Client A (user-alice)                    DNotifier                    Client B (user-bob)
         β”‚                                      β”‚                                β”‚
         β”‚  connect() + auth                    β”‚                                β”‚
         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚                                β”‚
         β”‚                                      │◄──────────────────────────────── connect()
         β”‚                                      β”‚                                β”‚
         β”‚  send({ receiverId: "user-bob" })    β”‚                                β”‚
         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚                                β”‚
         β”‚                                      β”‚  onMessage on bob's client     β”‚
         β”‚                                      β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚
  1. Both clients connect with the same appId but different userId values.

  2. Sender calls send() with senderId matching their connected user and receiverId set to the target.

  3. If the receiver is online, onMessage fires immediately with { metadata, payload }.

  4. Offline receivers do not get live delivery; use chat history if you need persistence.


Prerequisites

Before diving into realtime patterns:


Topics in this section

Topic
Description

Auth, handshake, disconnect

Core send() and onMessage

Fan-out to known IDs

Image, audio, doc via send()

Raw bytes with sendBinary()

Automatic split and reassembly

getPlanLimits(), size caps

Disconnects and recovery


Message model

Every incoming WebSocket message arrives as a DNotifierMessage:

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

  • payload β€” your data object with helpers (toJSON(), raw(), etc.)

See Understanding messages for the full model.


When to use chat or AI instead

Need
Use

Conversation threads with history

LLM answers and RAG

Simple live delivery to a user ID

Realtime communication (this section)


Use cases

For product-oriented examples (dashboards, notifications, collaboration), see Realtime communication use cases.

Last updated