Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. C++ Tracker
  6. Emitters

Emitters

The Tracker instance must be initialized with an emitter. This section will go into more depth about the Emitter and how it works under the hood.

Emitter emitter("com.acme", Emitter::Method::POST, Emitter::Protocol::HTTP, 52000, 52000, 500, "sp.db");

There are other optional arguments:

Argument NameDescriptionRequired?
uriThe URI to send events toYes
methodThe request type to use (GET or POST)Yes
protocolThe protocol to use (http or https)Yes
send_limitThe maximum amount of events to send at a timeYes
byte_limit_postThe byte limit when sending a POST requestYes
byte_limit_getThe byte limit when sending a GET requestYes
db_nameDefines the path and file name of the databaseYes

The db_name can be any valid path on your host file system (that can be created with the current user). By default it will create the required files wherever the application is being run from.

5.1 Under the hood

Once the emitter receives an event from the Tracker a few things start to happen:

  • The event is added to a local Sqlite3 database (blocking execution)
  • A long running daemon thread is started which will continue to send events as long as they can be found in the database (asynchronous)
  • The emitter loop will grab a range of events from the database up until the SendLimit as noted _above
  • The emitter will send all of these events as determined by the Request, Protocol and ByteLimits
    • Each request is sent in its thread.
  • Once sent it will process the results of all the requests sent and will remove all successfully sent events from the database