CountAsync

Returns the number of other connections sharing the same subscription.

Arguments

Copied to clipboard!
public async Task<int> CountAsync(string roomId);
Argument Type Description
room_id
string
Subscription room ID

Return

Returns the number of active connections using the same provided subscription room.

Exceptions

Throws a KuzzleException if there is an error. See how to handle error.

Usage

Copied to clipboard!
NotificationHandler listener = (response) => {};
try {
  string room_id = await kuzzle.Realtime.SubscribeAsync(
    "nyc-open-data",
    "yellow-taxi",
    JObject.Parse("{}"),
    listener);
  int count = await kuzzle.Realtime.CountAsync(room_id);
  Console.WriteLine($"Currently {count} active subscriptions");
} catch (KuzzleException e) {
  Console.WriteLine(e);
}