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
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 β
β βββββββββββββββββββββββββββββββββΊβBoth clients connect with the same
appIdbut differentuserIdvalues.Sender calls
send()withsenderIdmatching their connected user andreceiverIdset to the target.If the receiver is online,
onMessagefires immediately with{ metadata, payload }.Offline receivers do not get live delivery; use chat history if you need persistence.
Prerequisites
Before diving into realtime patterns:
Create an app and obtain
appId+secretInstall an SDK (JavaScript or Dart)
Your first connection with
transport: "ws"
Topics in this section
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, typepayloadβ yourdataobject with helpers (toJSON(),raw(), etc.)
See Understanding messages for the full model.
When to use chat or AI instead
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