Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.67 KB

README.md

File metadata and controls

71 lines (50 loc) · 2.67 KB

EventProducer

This module is only intended for internal use at TIDAL, but feel free to look at the code.

Event Producer is an events transportation layer of the TIDAL Event Platform (TEP). Its responsibility is to make sure that events get transported to the backend as fast, secure, and reliable as possible.

Features

  • Sending events in batches.
  • Filtering events based on the provided blocked consent categories list.
  • Collecting and sending monitoring data about dropped events.
  • Notifying about the Outage.

Documentation

Usage

Install via Swift Package file

Add the dependency to your existing Package.swift file.

dependencies: [
    .package(url: "https://tidal-music.github.io/tidal-sdk-ios", from: "<VERSION>"))
]

Install via Swift Package Manager with Xcode

  1. Select "File » Add Packages Dependencies..." and enter the repository URL https://github.com/tidal-music/tidal-sdk-ios into the search bar (top right).
  2. Set the Dependency Rule to "Up to next major", and the version number to that you want.
  3. When "Choose Package Products for tidal-sdk-ios" appears, make sure to add the EventProducer libary to your target.

Initialization

The EventSender role exposes functionality for sending events and monitoring the status of the transportation layer. It is exposed through it's shared singleton instance and is setup by providing appropriate configuration and CredentialsProvider.

let config: EventConfig = .init(
    credentialsProvider: credentialsProvider,
    maxDiskUsageBytes: 1000000,
    blockedConsentCategories: [ConsentCategory.performance]
)

let eventSender = TidalEventSender.shared
eventSender.config(config)

Sending events

eventSender.sendEvent(
    name: "click_button",
    consentCategory: ConsentCategory.performance,
    headers: ["client-id": "45678"]
    payload: "{'buttonId':'123'}",
)

Updating blockedConsentCategories on the fly

eventSender.setBlockedConsentCategories([ConsentCategory.targeting])

Receiving outage notifications

Not yet implemented