---
title: "Realtime: connecting and subscribing"
url: https://lumean.app/de/developers/docs/guide/realtime
locale: de
description: "Order, voice clone and gift code statuses over WebSocket. Connecting, authorizing subscriptions, channels and events."
updated: 2026-11-06
source_locale: en
sources: [get-user, get-orders-order, post-voices-provider-clones, get-reseller-codes]
errors: ["401", "403", "429", policy-cooldown-active]
spec_version: 1.0.0
---

# Realtime: connecting and subscribing

Order statuses arrive over WebSocket. The protocol is Pusher-compatible, so `pusher-js` and
Laravel Echo both work. Lumean has no SDK of its own. Subscribing is free and does not consume
the key's rate windows: only REST requests do.

## Connection

| Parameter | Value |
| --- | --- |
| Host / port / scheme | `ws.lumean.app` / `443` / `wss` (TLS required) |
| App key | `7c4dd881d8116ac76fe89aff71d8c2ff` |
| `cluster` | empty string (the server has no clusters) |
| Transports | `['ws', 'wss']` |
| Auth endpoint | `POST https://api.lumean.app/api/public/broadcasting/auth` |

```js
import Pusher from 'pusher-js'

const pusher = new Pusher('7c4dd881d8116ac76fe89aff71d8c2ff', {
  wsHost: 'ws.lumean.app', wsPort: 443, wssPort: 443,
  forceTLS: true, enabledTransports: ['ws', 'wss'], cluster: '',
  channelAuthorization: {
    endpoint: 'https://api.lumean.app/api/public/broadcasting/auth',
    headers: { 'X-API-KEY': process.env.LUMEAN_API_KEY },
  },
})

const ch = pusher.subscribe('private-orders.42')      // 42 = user_id of the key owner
ch.bind('status.changed', (e) => console.log(e.previous_status, '→', e.new_status))
```

The app key is public. It identifies the application, not you, so there is no need to hide it.
The only secret is `X-API-KEY`. It is sent only to the auth endpoint and never appears in
WebSocket frames.

Laravel Echo takes the same parameters (`authEndpoint` and `auth.headers`), but it adds the
`private-` prefix itself: `echo.private('orders.42')`.

## Subscription authorization

A private channel requires a signature. The library gets it for you:

1. It takes the `socket_id` from the `pusher:connection_established` frame.
2. It sends `socket_id` and `channel_name`, with the `private-` prefix, to
   `POST /broadcasting/auth` with the `X-API-KEY` header.
3. It puts the `auth` string from the response into the `pusher:subscribe` frame.

The response uses the Pusher format, outside the standard API envelope: it contains only `auth`,
with no `success` or `data`. The required scope depends on the channel; see the Scope column in
the channel table.

| Code | Cause | What to do |
| --- | --- | --- |
| `401` | The key is missing, unknown, deactivated or expired | Retrying will not help. Check the key with `GET /key` |
| `403` | The key lacks this channel's scope, or the channel belongs to another user. The owner is checked against the `user_id` in the channel name | Take `user_id` from `GET /user`, not from your own configuration |
| `429` | The auth endpoint's own limit of 1200 requests per minute was exceeded | Do not resubscribe in a loop: one connection carries all channels |

## Channels

| Channel | What it sends | Events | Parameter | Scope |
| --- | --- | --- | --- | --- |
| `private-orders.{userId}` | all orders on the account | 15 | numeric `id` of the key owner from `GET /user` | `orders.read` |
| `private-order.task.{orderId}` | a single order | 9 | order UUID (`data.id` from `POST /orders`) | `orders.read` |
| `private-chunks.preview.{userId}` | result of a background chunking preview | 1 | the same numeric `userId` | `orders.read` |
| `private-cartesia-voice-clones.{userId}` | Cartesia voice cloning progress | 1 | the same numeric `userId` | `voices.read` |
| `private-fishaudio-voice-clones.{userId}` | Fish Audio voice cloning progress | 1 | the same numeric `userId` | `voices.read` |
| `private-giftcodes.{userId}` | gift codes and reseller status | 4 | the same numeric `userId` | `reseller.read` |

### GET /user

Get profile of API key owner

Справочник: https://lumean.app/de/developers/docs/api/get-user

| Channel | Events |
| --- | --- |
| `private-orders.{userId}` | `created`, `status.changed`, `item.status.changed`, `progress`, `bulk_retry.completed`, `paragraph_regenerate.completed`, `order.queue.updated`, `voice_search.queue.updated`, `renamed`, `stitch.changed`, `policy_cooldown.applied`, `policy_cooldown.cleared`, `archive.progress`, `archive.ready`, `archive.failed` |
| `private-order.task.{orderId}` | the same, except `created`, `archive.*` and `policy_cooldown.*` |
| `private-chunks.preview.{userId}` | `ready` with the fields `status`, `preview_id`, `summary`, `page` |
| `private-cartesia-voice-clones.{userId}`, `private-fishaudio-voice-clones.{userId}` | `voice_clone.updated` |
| `private-giftcodes.{userId}` | `issued`, `status.changed`, `reseller.status.changed`, `reseller.application.status.changed` |

The `ready` event carries no chunks. Fetch them with
`GET /orders/chunks/preview/{previewId}?page=1`.

`voice_clone.updated` arrives on every clone status change: `pending` → `cloning` → `ready` or
`failed`. Without WebSocket, read the status from the clone list.

Gift code events contain only code masks. The full code is returned by `GET /reseller/codes` and
`GET /reseller/codes/{uuid}`.

Detect that an order is done by `status.changed` (`previous_status` → `new_status`), not by
progress counters. The last chunk and the terminal status are different moments.

## The `progress` event on two channels

| | `private-orders.{userId}` | `private-order.task.{orderId}` |
| --- | --- | --- |
| Identifier | `order_id` (UUID) | `task_id` (the same order UUID) |
| Counters | `completed` / `total` | `chunks_done` / `chunks_total` |
| Fraction done | `percent`, an integer `0..100` | `progress`, a number such as `42.5` |
| Also | — | `duration_seconds`, `eta_seconds`, `eta_confidence`, `timestamp` |

The event name is the same, but the fields differ. The only way to tell the events apart is the
channel, so give each channel its own handler.

The `progress` and `chunks_done` fields on `private-order.task.{orderId}` are kept for
compatibility and do not reflect actual progress. Take the fraction done from `percent` and
`completed`/`total` on `private-orders.{userId}`. `eta_seconds` gives the time remaining. When
`eta_confidence` is `low`, show it with a “≈” sign.

Both events count only the original chunks. Retries and regenerations are not included, so a
reworked order may never reach 100.

## Event names in Echo and pusher-js

**Правильно**

Echo, with a leading dot: `echo.private('orders.42').listen('.status.changed', fn)`.
pusher-js, without the dot: `pusher.subscribe('private-orders.42').bind('status.changed', fn)`.

**Неправильно**

Pass a dotted name to pusher-js: `bind('.status.changed')`. There is no error and the connection
stays alive, but no events arrive.

Without the dot, Echo prepends the Laravel event namespace to the name. A leading dot turns that
off.

## What events contain

- `created` and `status.changed` carry an order snapshot without the chunk list. Instead they
  include `items_summary: { total, by_status }`. `GET /orders/{order}` returns the chunks.
- Files arrive as metadata. `POST /storage/url` returns the download link.
- `renamed` and `archive.*` cannot be triggered with an API key: renaming and archives exist only
  in the web dashboard. The event arrives if the owner did it there.
- `policy_cooldown.applied` reports a cooldown before a request gets a `429`. The cooldown is
  applied when a failed task is finalized, not in response to a request. Take the end time from
  `retry_at` (ISO-8601): the event goes through a queue, and `retry_after` can go stale on the
  way.
- `order.queue.updated` reports that the order moved in the worker queue (every service except
  `voice_search`): `{ order_id, queue_position, queue_wait_seconds }`. It arrives only when the
  position changed, at most once every ~2 s; moves between positions of 100 and above are not
  sent. When a worker takes the task or the order is cancelled, one frame arrives with
  `queue_position: null`. `queue_wait_seconds` is always `null`. After a reconnect, re-read
  `GET /orders/{order}`: a missed frame is not repeated.

### 429 · `policy_cooldown_active` — policy_cooldown_active — order creation paused

| Что произошло | Что делать |
| --- | --- |
| Creating new orders is paused entirely, not just for the disputed text. The body has `retry_after` (seconds) and `retry_at` (ISO-8601), and the `Retry-After` header is set. | Waiting alone does not solve the problem. Fragments rejected by the policy go to the blocklist, and the same text gets a 422 `content_blocked` after the pause. Each new order that fails the policy again adds to the counter, and the next pause is longer. Edit the text. The API does not say what failed the check: the chunk comes back whole, and you have to rephrase the whole fragment. Any order that completes at least partially resets both the counter and the pause length. |

`Retry-After`: есть. Разбор: https://lumean.app/de/developers/docs/errors/policy-cooldown-active

## WebSocket or polling

For a single short order, polling `GET /orders/{order}` is simpler. A connection and event
handling pay off with a stream of orders or when a user watches the progress. Even with a
subscription, REST stays the source of truth, because an event may not arrive. Waiting for an
order without WebSocket is covered in [The asynchronous order model](/developers/docs/guide/async).

---

- Diese Seite im Browser: https://lumean.app/de/developers/docs/guide/realtime
- Vollständige maschinenlesbare Referenz: https://api.lumean.app/docs/llm.md
