Skip to main content

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

Signature:
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

ParameterTypeDescription
endpointstringThe collector to which events will be sent
protocolHttpProtocolhttp or https
portnumberThe port for requests to use
methodHttpMethodget or post
bufferSizenumberNumber of events which can be queued before flush is called
retrynumber | Partial<RequiredRetryOptions>Configure the retry policy for got - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#retry
cookieJarPromiseCookieJar | ToughCookieJarAdd a cookieJar to got - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#cookiejar
callback(error?: RequestError, response?: Response<string>) => voidCallback 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)
agentsAgentsSet new http.Agent and https.Agent objects on got requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#agent
Returns:

Emitter