Stream status
Watch queue status with Server-Sent Events when a live client wants updates.
Use the status stream when a live client wants queue updates over one connection.
Streaming is optional. The durable base API is still status_url polling, and the stream payload matches the normal status response.
Connect to the stream
const response = await fetch(
"https://audiolasso.dev/v1/queue/requests/req_01jabc/status/stream?logs=true",
{
headers: {
Authorization: `Bearer ${process.env.AUDIOLASSO_API_KEY}`,
Accept: "text/event-stream",
},
}
);
if (!response.body) throw new Error("No stream body");Parse events
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const events = buffer.split("\n\n");
buffer = events.pop() || "";
for (const event of events) {
const data = event
.split("\n")
.find((line) => line.startsWith("data: "));
if (!data) continue;
const payload = JSON.parse(data.slice(6));
console.log(payload.status, payload.logs?.[0]?.message);
if (payload.status === "COMPLETED" || payload.status === "FAILED") {
reader.cancel();
break;
}
}
}Stream events
The status event payload matches the normal queue status response.
event: status
data: {"request_id":"req_01jabc","model":"audio/separate","status":"IN_PROGRESS"}The stream closes when the job reaches COMPLETED or FAILED. If the stream window ends before the job completes, reconnect or fall back to polling the same status_url.
Use streaming for CLIs, dashboards, or browser sessions where live status is useful. Use polling for backend jobs and simple integrations.