count #
Returns the number of other connections sharing the same subscription.
Arguments #
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 #
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());
}