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

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");
  },
});

Redact secrets and PII from logs before sharing them with support.


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:

  1. Authenticate over HTTPS

  2. Receive auth token and plan limits

  3. Open WebSocket (WSS) to the production host

  4. Handshake with token

  5. onConnected fires

→ Connection lifecycle · Endpoints & custom URL

Use browser DevTools Network → WS to inspect frames in web clients.


Transport-specific debugging

Transport
Check

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

→ Choose your transport


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 messageSizeLimit on both sender and receiver plans

  • Wait for full reassembly — only complete messages invoke onMessage

  • Browser clients: the SDK configures the socket for binary payloads automatically

→ Large messages & chunking


AI and workflow debugging

Feature
Debug approach

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:

→ Workflow observability


Dashboard tools

Dashboard area
Use for

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:

→ Endpoints & custom URL


Common mistakes checklist

Mistake
Symptom

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

Last updated