Choose your transport
DNotifier SDKs support two transports: WebSocket (ws) and HTTP (http). Both use the same credentials and authenticate the same way at connect(). The difference is how messages flow after authentication.
Decision table
Criterion
WebSocket (ws)
HTTP (http)
Best for
Realtime messaging, live chat, push-style delivery
AI prompts, RAG, knowledge-base APIs, workflows
Connection
Persistent socket; server pushes incoming messages
Stateless request/response per call
Incoming messages
Delivered to onMessage in real time
Not used for push; responses return from method calls
send() for 1:1 chat
β Recommended
β οΈ Possible but not ideal for live UX
sendAI()
β Use HTTP instead
β Recommended
Knowledge base (add/search/list)
β Use HTTP instead
β Recommended
runWorkflow()
β Use HTTP instead
β Recommended
Browser support
Native WebSocket API
fetch / standard HTTP
Node.js
Requires WebSocketImpl (e.g. ws package)
Works out of the box
Reconnect handling
Your app should handle disconnects
N/A β each call is independent
When to use WebSocket
Choose transport: "ws" when you need:
Realtime 1:1 messaging between users, devices, or services
Live chat with instant delivery to
onMessageBinary or large structured payloads with automatic chunking over a persistent connection
Low-latency push without polling
Typical apps: chat clients, live collaboration, device telemetry with bidirectional frames, notification feeds where the server initiates delivery.
When to use HTTP
Choose transport: "http" when you need:
AI β
sendAI, session continuation,fetchAIHistoryRAG / knowledge base β
addDocument,search,listDocuments, etc.Workflows β
runWorkflowwith agents and observabilityServer-side RPC where each operation is a discrete HTTP call
Typical apps: backend AI assistants, document indexing pipelines, admin tools, cron jobs, API routes that answer a prompt and return JSON.
Can I use both?
Yes. Many production systems use two SDK instances (or reconnect with different transports at different lifecycle stages):
Chat UI
ws
Realtime send/receive
API server
http
AI, RAG, workflows
Use the same appId and secret, but pick the transport that matches each code path.
Authentication is the same
Both transports call the DNotifier auth endpoint during connect(). You receive:
An auth token
Plan limits (
getPlanLimits())aiEnabledand message size caps
WebSocket clients then open a socket and complete a handshake. HTTP clients mark themselves connected without maintaining a socket.
Next steps
Install an SDK β Add the package for your language
Your first connection β Connect with your chosen transport
Your first message β Send a 1:1 message (WebSocket)
Last updated