NetworkConfiguration

class NetworkConfiguration : NetworkConfigurationInterface, Configuration

Represents the network communication configuration allowing the tracker to be able to send events to the Snowplow collector.

Default values:

method: HttpMethod.POST

protocol: Protocol.HTTPS

timeout: 5 seconds

Constructors

Link copied to clipboard
constructor(endpoint: String, method: HttpMethod = HttpMethod.POST)
constructor(networkConnection: NetworkConnection)
constructor(jsonObject: JSONObject)

This constructor is used during remote configuration.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun copy(): Configuration
Link copied to clipboard

A custom path which will be added to the endpoint URL to specify the complete URL of the event collector when paired with the POST method. The default path is "com.snowplowanalytics/snowplow/tp2". The collector must be configured to accept the custom path.

Link copied to clipboard
fun okHttpClient(okHttpClient: OkHttpClient): NetworkConfiguration

An OkHttp client that will be used in the emitter. You can provide your own if you want to share your Singleton client's interceptors, connection pool etc. By default a new OkHttpClient is created when the tracker is instantiated.

Link copied to clipboard
fun okHttpCookieJar(okHttpCookieJar: CookieJar): NetworkConfiguration

An OkHttp cookie jar to override the default CollectorCookieJar that stores cookies in SharedPreferences. A cookie jar provided here will be ignored if a custom okHttpClient is configured.

Link copied to clipboard

Custom headers to add to HTTP requests to the collector.

Link copied to clipboard

The timeout set for the requests to the collector. The maximum timeout for emitting events. If emit time exceeds this value TimeOutException will be thrown.

Properties

Link copied to clipboard
open override var customPostPath: String?

A custom path which will be added to the endpoint URL to specify the complete URL of the collector when paired with the POST method.

Link copied to clipboard
open override var endpoint: String?
Link copied to clipboard
open override var method: HttpMethod
Link copied to clipboard

Custom NetworkConnection instance to use for sending events.

Link copied to clipboard
open override var okHttpClient: OkHttpClient?

An OkHttp client that will be used in the emitter. You can provide your own if you want to share your Singleton client's interceptors, connection pool etc. By default a new OkHttpClient is created when the tracker is instantiated.

Link copied to clipboard
open override var okHttpCookieJar: CookieJar?

An OkHttp cookie jar to override the default CollectorCookieJar that stores cookies in SharedPreferences. A cookie jar provided here will be ignored if a custom okHttpClient is configured.

Link copied to clipboard
open override var protocol: Protocol?
Link copied to clipboard
open override var requestHeaders: Map<String, String>?

Custom headers to add to HTTP requests to the collector.

Link copied to clipboard
open override var timeout: Int?

The timeout set for the requests to the collector. The maximum timeout for emitting events. If emit time exceeds this value TimeOutException will be thrown.