publishMessage

Publish a real-time message.


publishMessage(Document, [options], [callback])

Arguments Type Description
Document object Document object
options JSON Object Optional parameters
callback function Optional callback

publishMessage(content, [options], [callback])

Arguments Type Description
content JSON Object Content of the document to publish
options JSON Object Optional parameters
callback function Optional callback

Options

Option Type Description Default
volatile JSON Object Additional information passed to notifications to other users null
queuable boolean Make this request queuable or not true

Return Value

Returns the Collection object to allow chaining.


Callback Response

Returns a raw Kuzzle response in JSON format.

Usage

Copied to clipboard!

JSONObject message = new JSONObject().put("some", "content");
JSONObject volatile = new JSONObject().put("volatile", "are volatile information");
Options opts = new Options().setVolatile(volatile);

kuzzle
  .collection("collection", "index")
  .publishMessage(message, opts);