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:When to Use WebSockets vs Webhooks
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 Laravel Echo (Recommended for Frontend)
Using Pusher Client Directly
Channels
Each client has a private channel scoped to their account: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: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:
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 apusher:ping event within the timeout window to maintain the connection.
Reconnection
The Pusher client handles reconnection automatically with exponential backoff.Troubleshooting
Connection fails immediately
Connection fails immediately
- Verify your API token is valid
- Check that you’re using
soketi.deapi.aias the host - Ensure port 443 is not blocked by your firewall
Not receiving events
Not receiving events
- Use
.request.status.updatedwith Echo (dot prefix) orrequest.status.updatedwith Pusher (no dot) - Verify subscription succeeded via
pusher:subscription_succeededevent - Ensure jobs are submitted with the same client credentials
Connection drops frequently
Connection drops frequently
- The client library reconnects automatically
- Monitor
state_changeevents to track connection health - Consider using webhooks as a backup