SDK
SDK Java v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

count #

Returns the number of other connections sharing the same subscription.

Arguments #

Copied to clipboard!
public int count(String roomId)
public int count(String roomId, io.kuzzle.sdk.QueryOptions options)

Arguments Type Description
roomId
String
Subscription room ID
options
io.kuzzle.sdk.QueryOptions
QueryOptions

options #

Additional query options

Option Type
(default)
Description
queuable
boolean

(true)
Make this request queuable or not

Return #

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

Exceptions #

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

Usage #

Copied to clipboard!
NotificationListener listener = new NotificationListener() {
  public void onMessage(NotificationResult notification) {}
};
try {
  String roomId = kuzzle.getRealtime().subscribe(
    "nyc-open-data", 
    "yellow-taxi", 
    "{}", 
    listener
  );
  int count = kuzzle.getRealtime().count(roomId);
  System.out.println("Currently " + count + " active subscription");
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}