Debugging
Techniques and tools for diagnosing DNotifier SDK issues during development and staging. Use this guide before escalating to Troubleshooting for production incidents.
Enable verbose logging in your app
The SDK does not ship a global debug flag. Wrap SDK callbacks with your own logging:
const notifier = new DNotifier({
// ...
onConnected: () => {
console.log("[DNotifier] connected", {
isConnected: notifier.isConnected,
aiEnabled: notifier.aiEnabled,
messageSizeLimit: notifier.messageSizeLimit,
limits: notifier.getPlanLimits(),
});
},
onMessage: (msg) => {
console.log("[DNotifier] message", {
sender: msg.metadata.sender,
type: msg.metadata.type,
id: msg.metadata.id,
payload: msg.payload.toJSON(),
});
},
onDisconnected: () => {
console.log("[DNotifier] disconnected");
},
});Verify authentication first
Most issues trace to auth or transport misconfiguration. Run this minimal check:
JavaScript (Node.js)
Dart
Inspect connection lifecycle
Expected WebSocket sequence:
Authenticate over HTTPS
Receive auth token and plan limits
Open WebSocket (WSS) to the production host
Handshake with token
onConnectedfires
→ Connection lifecycle · Endpoints & custom URL
Use browser DevTools Network → WS to inspect frames in web clients.
Transport-specific debugging
ws (Node)
WebSocketImpl passed? ws package installed?
ws (browser)
No WebSocketImpl needed; check CSP connect-src
http
connect() completes but no socket — normal; test sendAI next
Dart / Flutter
Same endpoints; no WebSocketImpl required
Message flow debugging
Outbound
Log every send() with senderId, receiverId, and payload type:
Inbound
Confirm onMessage is registered before connect(). Messages arriving during connect are rare but callbacks must exist.
Chunked messages
If large payloads never appear complete:
Confirm
messageSizeLimiton both sender and receiver plansWait for full reassembly — only complete messages invoke
onMessageBrowser clients: the SDK configures the socket for binary payloads automatically
AI and workflow debugging
sendAI
Log full response object; check aiEnabled
search
Log hits length and similarity scores
Workflows
Set observability: true; find executionId in dashboard
Session logging
Set logs: true; verify sessions in AI logs dashboard
Catch WorkflowError for validation failures:
Dashboard tools
App credentials, plan, usage
AI session logs
When logs: true
Workflow executions
When observability: true
Custom WebSocket URL
Override the WebSocket URL only when DNotifier has provided a dedicated host:
Common mistakes checklist
send() before await connect()
WebSocket not connected / StateError
Wrong userId as receiverId
Message "sent" but peer never receives
HTTP transport for chat
No realtime onMessage delivery
Secret in browser bundle
Auth works in dev, security incident in prod
Duplicate userId on two tabs
Both receive messages for that ID — often intended
Next steps
Troubleshooting — production issue playbooks
Last updated