This reference assumes you have already set up the Hop server-side SDK.

Get Stats

The following function will return the following type:

type Stats = {
  // How many clients are connected to this channel
  online_count: number;
};
// Import your Hop SDK instance
import { hop } from ".";

const channelId = "channel_xxx"; // the channel we want to get statistics for

const stats = await hop.channels.getStats(channelId);
/*
 * - stats = {
 * -     "online_count": 0
 * - }
 */