API v 1.2
JavaScript

Statistics

The Ably service retains usage statistics per application and per account at 1 minute intervals. Your application statistics are available programmatically through our client libraries at 1 minute intervals, or aggregated up to the hour, day, or month.

 Tip

Your most recent statistics are delayed by up to 6 seconds.

Your application and account statistics are also available as graphs, tabular data or downloads in your application dashboard.

The Ably service aggregates your application statistics by minute, hour, day and month, both at an application level and at an account level. Account level statistics are not available via the client library APIs and must be viewed using your account dashboard. Your monthly quota and any potential overages are calculated using the account level statistics. Find out what happens if you exceed your package limits.

The Ably Realtime client library provides a straightforward API for retrieving application statistics:

JavaScript
var realtime = new Ably.Realtime('<loading API key, please wait>'); realtime.stats({ unit: 'hour' }, function(err, resultPage) { var thisHour = resultPage.items[0]; console.log(thisHour); // => {all: a, inbound: f, outbound: f, …} });
Demo Only
Copied!

Note that all examples on this page assume you are running them within an EventMachine reactor. Find out more in our Realtime usage documentation

View the Statistics API Reference.