node-tracker.gotemitter
Home > @snowplow/node-tracker > gotEmitter
gotEmitter() function
Create an emitter object, which uses the got
library, that will send events to a collector
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents): Emitter;
Parameters
Parameter | Type | Description |
---|---|---|
endpoint | string | The collector to which events will be sent |
protocol | HttpProtocol | http or https |
port | number | The port for requests to use |
method | HttpMethod | get or post |
bufferSize | number | Number of events which can be queued before flush is called |
retry | number | Partial<RequiredRetryOptions> | Configure the retry policy for got - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#retry |
cookieJar | PromiseCookieJar | ToughCookieJar | Add a cookieJar to got - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#cookiejar |
callback | (error?: RequestError, response?: Response<string>) => void | Callback called after a got request following retries - called with ErrorRequest (https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#errors) and Response (https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#response) |
agents | Agents | Set new http.Agent and https.Agent objects on got requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#agent |
Emitter