count #
Returns the number of other connections sharing the same subscription.
Arguments #
public CompletableFuture<Integer> count(final String roomId)
throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
room_id | String | Subscription room ID |
Return #
Returns the number of active connections using the same provided subscription room.
Usage #
SubscribeOptions options = new SubscribeOptions();
options.setSubscribeToSelf(true);
ConcurrentHashMap<String, Object> filters = new ConcurrentHashMap<>();
filters.put("exists", "name");
ConcurrentHashMap<String, Object> document = new ConcurrentHashMap<>();
document.put("name", "nina-vkote");
final String roomId = kuzzle.getRealtimeController().subscribe(
"nyc-open-data",
"yellow-taxi",
filters,
notification -> {
if (notification.scope.equals(SubscribeOptions.Scope.IN.toString())) {
System.out.println("Document entered the scope");
} else {
System.out.println("Document left the scope");
}
}).get();
final Integer result = kuzzle.getRealtimeController().count(roomId).get();
Edit this page on Github(opens new window)