HTTP Event Client v0.1.17 HTTPEventClient View Source

Emits events to an HTTP event server. Events can get sent either async or inline. Events are sent over the default http method POST. This can be configured with the default_http_method config option. Events are sent to the url provided with the event_server_url option. You may also set the force_ssl option to force events to be sent over SSL. Only events with numbers or letters are allowed.

Simple event

HTTPEventClient.emit(“something happend”)

Event with data

HTTPEventClient.emit(“something happend”, %{username: “john doe”})

Async event

HTTPEventClient.emit_async(“something happend”)

Multiple Clients

To allow for multiple clients, you can instead pass a client object as the first parameter to the emit methods. The client can be defined using the struct for this module. It accepts all of the same options as the config does. Here is and example

client = %HTTPEventClient{
            event_server_url: "https://event.example.com/events",
            api_token: "d0fe388f-d491-4ef2-ae48-749c760c42af"
          }

HTTPEventClient.emit(client, "ping")

Link to this section Summary

Link to this section Functions

Sends events and awaits a response.

Link to this function emit(client, event, data) View Source
Link to this function emit(client, event, data, method) View Source
Link to this function emit_async(client, event) View Source

Sends events async.

Link to this function emit_async(client, event, data) View Source
Link to this function emit_async(client, event, data, method) View Source