SDK
SDK C# v1.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.

PublishAsync #

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 async Task PublishAsync(string index, string collection, JObject message);
ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
message
JObject
JObject representing a JSON payload

Exceptions #

Throws a KuzzleException if there is an error. See how to handle error.

Usage #

try {
  JObject message = JObject.Parse("{ realtime: 'rule the web' }");
  await kuzzle.Realtime.PublishAsync("i-dont-exist", "in-database", message);
  Console.WriteLine("Message successfully published");
} catch (KuzzleException e) {
  Console.WriteLine(e);
}