SDK
SDK PHP v3.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.

publishMessage #

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
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the Collection object to allow chaining.


Callback Response #

Returns a raw Kuzzle response in JSON format.

Usage #

<?php
use \Kuzzle\Kuzzle;
$message = [
  'field' => 'value'
];
$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');
try {
  $result = $dataCollection->publishMessage($message);
}
catch (ErrorException $e) {
}