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
- 1. Overview
- 2. Responder actions
- 2.1 Trigger event (real-time)
- 2.1.1 Overview
- 2.1.2 Command format
- 2.1.3 Example command
- 2.1.4 Response algorithm
- 2.1.5 Usage examples
- 2.1.5.1 Kinesis stream
- 2.1 Trigger event (real-time)
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.
Currently this responder only supports one action:
Type | Identifier | Action performed in Pusher |
---|---|---|
Command | com.pusher.sauna.commands/trigger_event |
Triggers a Pusher event |
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.
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
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
As with all RT responders, Sauna will take each command and:
- Validate it as a valid Pusher
trigger_event
command - If it is not valid, this will be reported to any configured Sauna loggers
- If it is valid, Sauna will attempt to trigger the event to the Pusher REST API
- If the API reports success (200), this will be reported to any configured Sauna loggers
- 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.
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 themy-dev-channel
andmy-test-channel
channels - Whether or not the event was successfully send will be reported to any configured Sauna loggers.