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);
Argument | Type | Description |
---|---|---|
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);
}
Edit this page on Github(opens new window)