count #
Returns the number of other connections sharing the same subscription.
:::: tabs ::: tab Java
Arguments #
public CompletableFuture<Integer> count(String roomId)
throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
roomId | String | Subscription room ID |
Return #
Returns the number of active connections using the same provided subscription room.
Usage #
Map<String, Object> filters = new HashMap<>();
filters.put("exists", "name");
final String roomId = kuzzle.getRealtimeController().subscribe(
"nyc-open-data",
"yellow-taxi",
filters,
notification -> {
if (notification.getScope().equals("in")) {
System.out.println("Document entered the scope");
} else {
System.out.println("Document left the scope");
}
}).get();
final Integer result = kuzzle.getRealtimeController().count(roomId).get();
::: ::: tab Kotlin
Arguments #
fun count(roomId: String): CompletableFuture<Int>
Argument | Type | Description |
---|---|---|
roomId | String | Subscription room ID |
Return #
Returns the number of active connections using the same provided subscription room.
Usage #
val filters: Map<String, Any> = HashMap<String, Any>().apply {
put("exists", "name")
}
val roomId: String = kuzzle.realtimeController.subscribe(
"nyc-open-data",
"yellow-taxi",
filters
) {
if (it.scope == "in") {
println("Document entered the scope")
} else {
println("Document left the scope")
}
}.get()
val result: Int = kuzzle.realtimeController.count(roomId).get()
::: ::::
Edit this page on Github(opens new window)