RTDS Monitoring Workflow
This workflow connects to RTDS, processes events, and handles reconnection.
Prerequisites
- RTDS must be enabled for your Airship account
- RTDS access token configured in dashboard
- Application ready to process events
- App key
Skills Required
Step 1: Connect to RTDS Stream
Connect with filters for specific event types:
POST https://connect.urbanairship.com/api/events
Authorization: Bearer <rtds-access-token>
X-UA-Appkey: <app-key>
Accept: application/vnd.urbanairship+x-ndjson; version=3;
Content-Type: application/json
{
"start": "LATEST",
"filters": [
{
"types": ["OPEN", "SEND", "CLICK", "CUSTOM"]
}
]
}
Response: Stream of NDJSON events:
{"id":"event-1","type":"OPEN","offset":"offset-1",...}
{"id":"event-2","type":"SEND","offset":"offset-2",...}
{"id":"event-3","type":"CLICK","offset":"offset-3",...}
Step 2: Process Events
For each event in the stream:
- Parse the JSON event
- Extract the
offsetfield - Process the event (store in database, trigger actions, etc.)
- Store the
offsetas the last processed offset
Step 3: Handle Disconnection
If the connection drops:
- Use the last stored
offset - Reconnect with
resume_offset:
POST https://connect.urbanairship.com/api/events
Authorization: Bearer <rtds-access-token>
X-UA-Appkey: <app-key>
Accept: application/vnd.urbanairship+x-ndjson; version=3;
Content-Type: application/json
{
"resume_offset": "offset-3",
"filters": [
{
"types": ["OPEN", "SEND", "CLICK", "CUSTOM"]
}
]
}
This ensures no events are missed between disconnection and reconnection.
Outcomes
- Real-time event stream connection
- Processed events stored/analyzed
- Seamless reconnection capability
Use Cases
- Real-time push delivery monitoring
- Custom event tracking
- Compliance monitoring
- User behavior analysis
- Integration with external systems
Best Practices
- Store offsets: Always track the last processed offset for seamless reconnection
- Use appropriate filters: Filter RTDS events at the API level to reduce processing overhead
- Handle errors gracefully: Implement retry logic and error handling for network issues
- Process events efficiently: Parse and process events as they arrive to avoid backlog