Client SDKs

Subscribe to real-time job updates in your mobile app.

Client SDKs are for mobile/web apps. They use user tokens (JWT) and can only read job state — they cannot start, update, or complete jobs. For server-side job management, use the Backend SDKs.

Consumer vs Producer Pattern

Client SDKs act as consumers that listen for job updates, while Backend SDKs are producers that create and update jobs:

Backend SDK (Producer)
jobs.start() ──────┐
job.setProgress() ─┤
job.complete() ────┤
job.fail() ────────┘
WRITE operations
S
Seenn
Client SDK (Consumer)
┌───── subscribe(jobId)
├───── onProgress.listen()
├───── onComplete.listen()
└───── onFailed.listen()
READ operations

When to Use Client SDK

✓ Use Client SDK when:
  • Building a mobile or web app
  • Showing real-time progress to users
  • Displaying iOS Live Activity / Android notifications
  • Updating UI with job status
  • Subscribing to job completion events
✗ Don't use Client SDK for:

How Client SDKs Work

Client SDKs connect to Seenn via Server-Sent Events (SSE) to receive real-time job updates:

📱
Your App
SSE (real-time)
S
Seenn
  1. Initialize with user token — Your backend generates a user token and passes it to the client
  2. SSE connection opens — SDK establishes a persistent connection to Seenn
  3. Subscribe to jobs — Listen for updates on specific job IDs
  4. Receive real-time updates — Progress, messages, completion, and failures stream instantly

Authentication Flow

Client SDKs use user tokens (JWT) generated by your backend:

// 1. Backend generates token (Node.js)
const userToken = await seenn.users.createToken({
  userId: 'user_123',
  expiresIn: '7d',
});

// 2. Send token to your mobile app via your API
res.json({ userToken });

// 3. Client initializes SDK with token (Flutter)
await Seenn.init(
  appId: 'app_xxx',
  userToken: tokenFromBackend,
);
User tokens are scoped to a specific user. They can only see jobs belonging to that user.

Key Features

Real-time SSE

Instant updates via Server-Sent Events with automatic reconnection.

iOS Live Activity

Show progress on Dynamic Island and Lock Screen automatically.

Reactive Streams

RxDart streams (Flutter) and hooks (React Native) for easy UI binding.

Auto Reconnection

Automatic reconnection with exponential backoff and missed event recovery.

Quick Example

import 'package:seenn_flutter/seenn_flutter.dart';

// Initialize once at app startup
await Seenn.init(
  appId: 'app_xxx',
  userToken: userToken,
);

// Subscribe to a specific job
final tracker = Seenn.instance.jobs.subscribe('job_123');

// Listen to progress updates
tracker.onProgress.listen((update) {
  print('Progress: \${update.progress}%');
  print('Message: \${update.message}');
});

// Listen to completion
tracker.onComplete.listen((job) {
  print('Completed! Result: \${job.resultUrl}');
});

// Listen to failures
tracker.onFailed.listen((job) {
  print('Failed: \${job.errorMessage}');
});

Available SDKs