SDK
SDK PHP v3.x
1

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