Skip to main content
GET
/
pixelStripeApi
/
projects
/
liveStats
/
{id}
curl -G https://api.streampixel.io/pixelStripeApi/projects/liveStats/[YOUR_PROJECT_ID] \
  --data-urlencode "userId=[YOUR_USER_ID]"
{
  "liveUser": 0,
  "queueUser": 0
}

Documentation Index

Fetch the complete documentation index at: https://docs.streampixel.io/llms.txt

Use this file to discover all available pages before exploring further.

Return the current concurrency for a project — how many users are streaming right now, and how many are waiting in the queue. This is the single hottest read endpoint in the API and the right primitive for building monitoring dashboards, autoscaling signals, and capacity alerts.

When to use it

Monitoring dashboards

Render a live concurrency widget without fetching the entire project object.

Capacity alerts

Page on-call when usersInQueue crosses a threshold for too long.

Scale signals

Feed liveUser into your autoscaler for any companion infrastructure.

Status pages

Show real-time usage to your customers or stakeholders.

Prerequisites

RequirementWhere to get it
User IDFinding your IDs
Project IDFinding your IDs

Path parameter

id
string
required
The project ID to get stats for.

Query parameter

userId
string
required
The ID of the account that owns the project. Used for authorization.

Response

liveUser
number
Current number of connected streaming sessions on the project.
queueUser
number
Number of users currently waiting in the queue for a session slot.
curl -G https://api.streampixel.io/pixelStripeApi/projects/liveStats/[YOUR_PROJECT_ID] \
  --data-urlencode "userId=[YOUR_USER_ID]"
{
  "liveUser": 0,
  "queueUser": 0
}

Polling guidance

This endpoint is read-optimized, but it is not free.
Do not poll faster than once every 5 seconds. Aggressive polling against liveStats is the most common cause of fair-use throttling. If you need sub-second updates, contact support — there is no streaming or websocket alternative today.
Practical defaults:
  • Operator dashboards — poll every 5–10s.
  • Background telemetry — poll every 30–60s and write to your time-series database.
  • Alerting — poll every 30s and require N consecutive samples above threshold before paging.

Node.js polling example

Node.js
const axios = require('axios');

const PROJECT_ID = '[YOUR_PROJECT_ID]';
const USER_ID = '[YOUR_USER_ID]';
const POLL_INTERVAL_MS = 10_000;

async function fetchStats() {
  try {
    const { data } = await axios.get(
      `https://api.streampixel.io/pixelStripeApi/projects/liveStats/${PROJECT_ID}`,
      { params: { userId: USER_ID } }
    );

    console.log(
      `[${new Date().toISOString()}] live=${data.liveUser} queue=${data.queueUser}`
    );

    if (data.queueUser > 5) {
      console.warn('Queue is backing up — consider scaling.');
    }
  } catch (err) {
    console.error('Stats fetch failed:', err.response?.data?.message ?? err.message);
  }
}

setInterval(fetchStats, POLL_INTERVAL_MS);
fetchStats(); // fire immediately
Always handle failures gracefully in a polling loop — one network blip should not crash your dashboard process. Wrap each call in try/catch and keep polling.

Common pitfalls

SymptomLikely cause
liveUser is always 0The project may be paused, or no clients are connected. Confirm via the dashboard.
Numbers swing wildly between pollsSessions naturally start and end — smooth values client-side with a 30–60 second moving average for dashboards.
Sudden 429 responsesYou’re polling faster than the rate-limit budget allows. Back off.
403 Forbidden after a project transferThe owning userId changed. Update the credentials your poller is using.

Next steps

Get Project

Need more than concurrency? Pull the full project object including the build list.

Rate limits & errors

Understand the throttling rules before deploying a high-frequency poller.