SDK
SDK Jvm v1.x
2

unsubscribe #

Removes a subscription.

:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Void> unsubscribe(final String roomId) 
  throws NotConnectedException, InternalException
Argument Type Description
roomId
String
Subscription room ID

Usage #

Copied to clipboard!
Map<String, Object> filters = new HashMap<>();
filters.put("exists", "name");
Map<String, Object> document = new HashMap<>();
document.put("name", "nina-vkote");
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();
kuzzle.getRealtimeController().unsubscribe(roomId).get();

::: ::: tab Kotlin

Arguments #

Copied to clipboard!
fun unsubscribe(roomId: String): CompletableFuture<Void>
Argument Type Description
roomId
String
Subscription room ID

Usage #

Copied to clipboard!
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 document: Map<String, Any> = HashMap<String, Any>().apply {
  put("name", "nina-vkote")
}
kuzzle.realtimeController.unsubscribe(roomId)

::: ::::