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.

publish #

Sends a real-time <message> to Kuzzle. The <message> will be dispatched to all clients with subscriptions matching the <index>, the <collection> and the <message> content.

The <index> and <collection> are indicative and serve only to distinguish the rooms. They are not required to exist in the database

Note: real-time messages are not persisted in the database.

Arguments #

Copied to clipboard!
public void publish(String index, String collection, String message)
public void publish(
  String index,
  String collection,
  String message,
  io.kuzzle.sdk.QueryOptions options
)

Arguments Type Description
index
String
Index name
collection
String
Collection name
message
String
JSON string representing the message to send
options
io.kuzzle.sdk.QueryOptions
Query options

options #

Additional query options

Option Type
(default)
Description
queuable
boolean

(true)
Make this request queuable or not

Exceptions #

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

Usage #

Copied to clipboard!
try {
  String message = "{ \"realtime\": \"rule the web\" }";
  kuzzle.getRealtime().publish("i-dont-exist", "in-database", message);
  System.out.println("Success");
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}