Build a Live Queue Dashboard with Service Stats
Wall boards, agent consoles and reports for call queues (services) all start from the same data: the live stats of Wildix services. This short guide shows the quickest way to get them and points to the full reference.
Choose how to get the stats
| HTTP | WebSocket | |
|---|---|---|
| How | ListServices and GetServiceStats | Subscribe to the services topic |
| Best for | Reports, back-end collectors, simple pages | Wall boards and live consoles |
| Updates | As often as you poll (stats change at most every 5 seconds) | A snapshot first, then every change |
Minimal example: poll over HTTP
npm install @wildix/wda-stream-client
import {GetServiceStatsCommand, ListServicesCommand, WdaStreamClient} from '@wildix/wda-stream-client';
const client = new WdaStreamClient({
token: () => Promise.resolve({token: process.env.WILDIX_TOKEN!}),
});
// The services that are live right now
const {services} = await client.send(new ListServicesCommand({}));
// Stats of the current 15-minute window
const {services: withStats} = await client.send(
new GetServiceStatsCommand({ids: services.map((service) => service.id), periodMinutes: 15}),
);
for (const {id, stats} of withStats) {
console.log(id, stats);
}
The token needs the stream scopes (read). The WebSocket needs a user with a Premium license.
Read the numbers correctly
Counters are kept in 15-minute UTC buckets for the last hour and in hourly UTC buckets beyond that, so use periodSeconds from the response, not the period you requested,
as the denominator of every rate. Live values such as callsWaiting and the agents* counts do not depend on the
window.
Full guide
The complete guide covers the access rules and limits, the stats reference, the formulas for service level, abandon rate and average wait, a correct websocket client, and downloadable examples including a single-file dashboard: