Home > @snowplow/node-tracker > gotEmitter
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;| 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 |
Returns:
Emitter