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

Your first connection

Connecting is the first code you write after installing an SDK. This page explains the flow conceptually; language-specific guides contain copy-paste examples.

What connect() does

When you call connect(), the SDK performs two phases depending on transport:

Phase 1 β€” Authentication (all transports)

  1. Sends appId, appSecret, and userID to the DNotifier auth endpoint

  2. Receives an auth token and plan limits

  3. Sets aiEnabled, messageSizeLimit, and related properties on the client

If authentication fails (wrong secret, invalid app, plan issue), connect() throws an error.

Phase 2 β€” Transport setup

Transport
What happens after auth

ws

Opens a WebSocket to DNotifier, sends a handshake frame with the token, waits for acknowledgment, then sets isConnected = true and calls onConnected

http

Skips the persistent socket; sets isConnected = true and calls onConnected immediately after auth

For your first message tutorial, use transport: "ws" so you can send and receive in realtime.

Constructor options (common to all SDKs)

Option
Required
Description

appId

Yes

From dashboard

secret

Yes

From dashboard

transport

Yes

"ws" or "http"

userId

Yes

Your end-user or service identifier

onConnected

Recommended

Called when ready to send

onMessage

Recommended

Called for incoming WebSocket messages

onDisconnected

Recommended

Called when the socket closes

Optional: logs, url (custom WebSocket URL), and platform-specific WebSocket injection (Node.js).

Connection lifecycle

After a successful connect

You can read:

  • notifier.isConnected β€” true when ready

  • notifier.getPlanLimits() β€” quotas from your plan

  • notifier.aiEnabled β€” whether AI features are on

  • notifier.messageSizeLimit β€” max message size in bytes

  • notifier.authToken β€” token from the last auth (avoid logging in production)

Language guides

Pick your stack for a complete, runnable example:

Language
Guide

JavaScript / TypeScript

Dart / Flutter

Python

.NET, Android, and iOS SDKs are coming soon β€” use JavaScript, Dart, or Python guides until those packages ship.

Prerequisites checklist

Next step

After you connect successfully, send your first 1:1 message:

β†’ Your first message

Last updated