publish #
Sends a real-time message to Kuzzle. The message will be broadcasted 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 #
public CompletableFuture<Integer> publish(
final String index,
final String collection,
final ConcurrentHashMap<String, Object> message)
throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
message | ConcurrentHashMap<String, Object> | ConcurrentHashMap representing a JSON payload |
Usage #
ConcurrentHashMap<String, Object> document = new ConcurrentHashMap<>();
document.put("name", "nina-vkote");
kuzzle.getRealtimeController().publish("my-index", "my-collection", document);
Edit this page on Github(opens new window)