Skip to main content

Overview

WebSockets provide real-time job status updates through a persistent connection. Unlike polling, updates are pushed instantly as they happen, including live preview images during generation.
WebSockets are ideal for interactive applications where you need instant feedback on job progress.

Quick Start

Install the required packages:
Connect and listen for updates:

When to Use WebSockets vs Webhooks

For maximum reliability, use both: WebSockets for real-time UI updates and webhooks as a backup for critical notifications.

Configuration

Connection Details

Required Credentials

  • Client ID: Your unique identifier (from dashboard)
  • API Token: Your authentication token (see Quickstart)

Connecting

We use a Pusher-compatible protocol. You can use any Pusher client library.

Using Pusher Client Directly

Channels

Each client has a private channel scoped to their account:
Private channels require authentication. You can only subscribe to your own channel.
When using Laravel Echo, use .listen('.request.status.updated', ...) with a dot prefix. With raw Pusher, use .bind('request.status.updated', ...) without the dot.

Events

request.status.updated

Sent whenever a job’s status changes or progress is updated. Event Payload:
The result_url is a signed URL that expires. Download promptly or use the job status endpoint to get a fresh URL.

Status Flow

Complete Examples

React Hook

Node.js Backend

Authentication

Private channels require authorization via the broadcasting auth endpoint. Endpoint: POST https://api.deapi.ai/broadcasting/auth Headers:
Request:
Response:
The Pusher client libraries handle this automatically via the authorizer callback.

Connection Management

Keep-Alive

The WebSocket server expects a ping every 30 seconds. Most Pusher client libraries handle this automatically. If implementing a custom client, send a pusher:ping event within the timeout window to maintain the connection.

Reconnection

The Pusher client handles reconnection automatically with exponential backoff.

Troubleshooting

  • Verify your API token is valid
  • Check that you’re using soketi.deapi.ai as the host
  • Ensure port 443 is not blocked by your firewall
  • Confirm your client ID matches your API token
  • Verify channel name format: private-client.{your_client_id}
  • Check that your API token has not been revoked
  • Use .request.status.updated with Echo (dot prefix) or request.status.updated with Pusher (no dot)
  • Verify subscription succeeded via pusher:subscription_succeeded event
  • Ensure jobs are submitted with the same client credentials
  • The client library reconnects automatically
  • Monitor state_change events to track connection health
  • Consider using webhooks as a backup