Pusher Responder user guide - snowplow-archive/sauna GitHub Wiki

HOME > GUIDE FOR ANALYSTS > RESPONDERS > Pusher Responder user guide

This responder has not yet been implemented.

See also: Pusher Responder setup guide

Contents

1. Overview

This responder lets you publish events to the Pusher real-time platform. Pusher is a SaaS real-time messaging platform that lets you get app data to your web, mobile and IoT devices.

2. Responder actions

Currently this responder only supports one action:

Type Identifier Action performed in Pusher
Command com.pusher.sauna.commands/trigger_event Triggers a Pusher event

2.1 Trigger event (real-time)

2.1.1 Overview

This responder command lets you trigger or publish an event to your configured Pusher application. Under the hood, triggering a Pusher event in Sauna is just a simple authenticated call to the Pusher HTTP API.

Like all real-time responder actions, this action is triggered by a well-structured JSON command being received by a compatible observer.

2.1.3 Command format

The command must be configured using a self-describing JSON Schema which validates against this schema:

iglu:com.pusher.sauna.commands/trigger_event/jsonschema/1-0-0

2.1.3 Example command

A simple Pusher command will look as follows:

{
  "schema": "iglu:com.pusher.sauna.commands/trigger_event/jsonschema/1-0-0",

  "data": {
    "channels": [
      "my-dev-channel",
      "my-test-channel"
    ],
    "event": "my-event",
    "data": {
      "message": "hello",
      "isProduction": false,
      "myNumber": 42
    },
    "socketId": "123.12"
  }
}

Where:

  • channels is the non-empty list of channels within the app to which to publish the event - no more than 10 channels are allowed
  • event is the name of the event
  • data is the arbitrary JSON payload associated with the event
  • socketId is the optional socket ID to exclude from the publication - for more on this see Excluding event recipients

2.1.4 Response algorithm

As with all RT responders, Sauna will take each command and:

  1. Validate it as a valid Pusher trigger_event command
  2. If it is not valid, this will be reported to any configured Sauna loggers
  3. If it is valid, Sauna will attempt to trigger the event to the Pusher REST API
  4. If the API reports success (200), this will be reported to any configured Sauna loggers
  5. If the API reports failure (400/403/etc), this will be reported to any configured Sauna loggers but no retry will be attempted

In the case of failure, we do not attempt retry, even in the case of us temporarily exceeding API rate limits, because this could block other non-Pusher-related commands in the observed stream from executing.

2.1.5 Usage examples

2.1.5.1 Kinesis stream

Assuming that the Amazon Kinesis Observer receives the following command:

{
  "schema": "iglu:com.snowplowanalytics.sauna.commands/command/jsonschema/1-0-0",

  "data": {
    "envelope": {
      "schema": "iglu:com.snowplowanalytics.sauna.commands/envelope/jsonschema/1-0-0",
      "data": {
        "commandId": "9dadfc92-9311-43c7-9cee-61ab590a6e81",
        "whenCreated": "2017-01-02T19:14:42Z",
        "execution": {
          "semantics": "AT_LEAST_ONCE",
          "timeToLive": 1200000
        },
        "tags": {}
      }
    },
    "command": {
      "schema": "iglu:com.pusher.sauna.commands/trigger_event/jsonschema/1-0-0",
      "data": {
        "channels": [
          "my-dev-channel",
          "my-test-channel"
        ],
        "event": "my-event",
        "data": {
          "message": "hello",
          "isProduction": false,
          "myNumber": 42
        },
        "socketId": "123.12"
      }
    }
  }
}

And assuming that the current time is within 20 minutes (1,200,000 ms) of 2017-01-02T19:14:42Z, then:

  • Sauna will trigger a new event my-event within the configured Pusher application, to the my-dev-channel and my-test-channel channels
  • Whether or not the event was successfully send will be reported to any configured Sauna loggers.
⚠️ **GitHub.com Fallback** ⚠️