View Source Qnotix.Pub (Qnotix v1.0.0)

Publisher API

Link to this section Summary

Functions

Sends events (messages) to the Pub/Sub service.

Link to this section Functions

@spec pub(map()) :: :ok

Sends events (messages) to the Pub/Sub service.

parameters

Parameters

  • payload(map)

The message format has the following fields:

- id(string) - compulsory
- event = "message" - compulsory
- topic(string) - compulsory
- message(string) - compulsory
- title(string) - optional
- priority: 1, 2, 3, 4, or 5 (default 4)
- click(url) - optional
- tags(string array) - optional

example

Example

iex(1)> Qnotix.Pub.pub(%{"event" => "message", "id" => "FF73vmnSOnA7XLK", "topic" => "Security", "message" => "The perimeter has been breached!", "priority" => 4, "tags" => ["skull"], "title" => "Alarm",  "click" => "http://www.secincident.com/24284756"})
:ok