publishMessage

kuzzle
  .collection('collection', 'index')
  .publishMessage({foo: 'bar', baz: 'qux'});
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")
  .publish(message, opts);
<?php

use \Kuzzle\Kuzzle;

$message = [
  'field' => 'value'
];

$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');

try {
  $result = $dataCollection->publishMessage($message);
}
catch (ErrorException $e) {

}

Publish a real-time message.


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

ArgumentsTypeDescription
DocumentobjectDocument object
optionsJSON ObjectOptional parameters
callbackfunctionOptional callback

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

ArgumentsTypeDescription
contentJSON ObjectContent of the document to publish
optionsJSON ObjectOptional parameters
callbackfunctionOptional callback

Options

OptionTypeDescriptionDefault
volatileJSON ObjectAdditional information passed to notifications to other usersnull
queuablebooleanMark this request as (not) queuabletrue

Return value

Returns the Collection object to allow chaining.


Callback response

Resolves to a raw Kuzzle response in JSON format.