Skip to content
Lumean

Realtime: events over WebSocket

Order status, voice cloning progress and gift codes arrive as WebSocket events, so you don’t need to poll. The protocol is Pusher-compatible and the server is Reverb. Subscriptions are private and authorized with your API key.

Connection parameters

The server is run by Lumean; there is no Pusher cloud cluster. Set the host, port and scheme in the client by hand.

ParameterValueWhat it means
Hostws.lumean.appThe WebSocket server address: wsHost in pusher-js, wsHost plus wssHost in Laravel Echo.
Port443The same value for wsPort and wssPort — there is no separate non-TLS port.
Schemewsswss means forceTLS: true. A plain ws connection from a production domain will not go through.
App key7c4dd881d8116ac76fe89aff71d8c2ffThe Reverb application id. It is neither a secret nor your API key — every client uses the same one.
Subscription authhttps://api.lumean.app/api/public/broadcasting/authThe client posts socket_id and the channel name here to get a signature. Your API key travels only in this HTTP request.

The app key is public: it ships in the frontend bundle and is visible in the browser of any Pusher client. The only secret here is your API key. It travels in the X-API-KEY header of the subscription auth request, not over the socket.

How a subscription is authorized

Subscribing to a private channel takes several steps, and the client library does them for you. The steps show where a 403 came from.

  1. The socket opens

    The client connects to the host using the app key. Your API key is not involved yet — the socket opens even with an invalid key.

  2. socket_id arrives

    The server replies with pusher:connection_established carrying socket_id, which identifies this particular connection.

  3. The subscription is signed

    The client posts socket_id and the channel name to POST /broadcasting/auth with an X-API-KEY header. The server checks the key, the scope and channel ownership, then returns a signature. This is where 401, 403 and 429 come from.

  4. Subscribed, events flow

    The client hands the signature back, the channel confirms with pusher:subscription_succeeded — and only then do the channel events start arriving.

orders.readvoices.readreseller.read— the scopes checked at step three: each channel has its own, see the channel table below.

Connection snippets

Three clients, the same sequence. The key in the code is a placeholder: substitute yours, but do not commit it.

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': 'YOUR_API_KEY' },
  },
});

const channel = pusher.subscribe('private-orders.{userId}');
channel.bind('policy_cooldown.applied', (data) => {
  console.log(data);
});

Channels

The channels are private: names start with private-, and you substitute the parameter in braces yourself. Each channel requires its own scope — it is listed in the table.

Event names and shapes

The .progress event on two channels

// private-orders.{userId} → .progress
{ "order_id": "…", "completed": 3, "total": 7, "percent": 43 }
// private-order.task.{orderId} → .progress
{ "task_id": "…", "progress": 0, "chunks_done": 0, "chunks_total": 7, "eta_seconds": 12 }

One name, different fields. On the user orders channel the event counts an order’s completed chunks. On a single-order channel it carries the remaining-time estimate, and its progress and chunks_done fields do not reflect real progress.

Separate handlers by channel, not by event name. Full field tables are on the channel pages.

The leading dot in event names

echo.private(channel).listen('.status.changed', handler)
channel.bind('status.changed', handler)

Laravel Echo adds the application namespace to event names, and a leading dot cancels that. So in Echo the name has a dot: .status.changed. pusher-js has no namespace, so the name has no dot. Mix them up and the subscription succeeds, but no events arrive and no error is raised.

Authorization errors

All three arrive as an HTTP response to POST /broadcasting/auth, not over the socket. The socket is already open by then — which is why “connected” says nothing about your scopes.

CodeWhen it happensWhat to do
401The X-API-KEY header is missing, or the key is revoked or truncated.Verify the key with GET /key. The library takes the key in the subscription auth request headers, not in its constructor.
403The key works but lacks the scope for this channel: orders.read for orders, voices.read for voice clones, reseller.read for gift codes. Or the channel belongs to someone else: the userId and orderId in the name must belong to the key owner.Add the scope in your account and substitute your own identifier. A subscription will never hand you someone else’s order.
429Too many authorization attempts in a row — usually a reconnect loop with a bad key.Stop reconnecting, fix the key, connect again. Exponential backoff helps, but the cause is almost always the 401 one row above.

POST /broadcasting/auth

This endpoint is deliberately absent from the reference: nobody calls it by hand, the client library does. But when a subscription returns 403, this request is what you will be debugging — so it is documented here.

POST/broadcasting/auth

Authorizes a subscription to a private WebSocket channel using your API key. Client libraries (Laravel Echo, pusher-js) call this endpoint themselves — point their authEndpoint at it and add X-API-KEY to the auth headers.

Available channels are your own orders (private-orders.{userId}, private-order.task.{orderId}) and chunk-preview results (private-chunks.preview.{userId}, see POST /orders/chunks/preview) — permission orders.read — plus your Cartesia voice clones (private-cartesia-voice-clones.{userId}, see POST /voices/cartesia/clones) and Fish Audio voice clones (private-fishaudio-voice-clones.{userId}, see POST /voices/fishaudio/clones) — permission voices.read — and your reseller gift codes (private-giftcodes.{userId}) — permission reseller.read. Someone else's channel returns 403.

Subscribing removes the need to poll GET /orders/{order}: progress and completion arrive as events.

Required key permission: depends on the channel — orders.read for orders and chunk previews, voices.read for Cartesia and Fish Audio voice clones, reseller.read for reseller gift codes.

Request body

socket_idrequired

The WebSocket connection id delivered to the client in the pusher:connection_established event.

string
Example 12345.67890
channel_namerequired

Channel name. A key may only reach its own channels: orders private-orders.{userId} and private-order.task.{orderId}, chunk previews private-chunks.preview.{userId} (permission orders.read), Cartesia voice clones private-cartesia-voice-clones.{userId} and Fish Audio voice clones private-fishaudio-voice-clones.{userId} (permission voices.read), reseller gift codes private-giftcodes.{userId} (permission reseller.read).

string
Example private-orders.42

Possible responses

200

Subscription authorized. The client receives the subscription auth token.

Body example
{
  "auth": "a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890"
}
Response fields
authrequired

The channel subscription signature. Hand it back to the Pusher/Echo client verbatim — it fills the value in itself. This response carries no envelope: the protocol dictates the shape.

string
Example a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890
401

The key is missing, unknown, disabled or expired.

Analyse this response
Body example

This response has no body.

403

The key lacks the permission the channel requires (orders.read for orders and chunk previews, voices.read for Cartesia and Fish Audio voice clones, reseller.read for reseller gift codes), or the channel belongs to someone else.

Analyse this response
Body example

This response has no body.

422

Invalid socket_id/channel_name (for example a channel_name without the private- prefix).

Analyse this response
Body example

This response has no body.

429

Rate limit exceeded — 1200 requests per minute.

Analyse this response
Body example

This response has no body.

Authentication and scopes·Guide: realtime instead of polling

This page for AI

Open .mdllm.md

API version 1.0.0