Class: EventStream

EventStream(client, streamPosition, optionsopt)

Stream of Box events from a given client and point in time.

Constructor

new EventStream(client, streamPosition, optionsopt)

Parameters:
Name Type Attributes Description
client BoxClient The client to use to get events
streamPosition string The point in time to start at
options Object <optional>
Optional parameters
Properties
Name Type Attributes Default Description
retryDelay int <optional>
1000 Number of ms to wait before retrying after an error
deduplicationFilterSize int <optional>
5000 Number of IDs to track for deduplication
fetchInterval int <optional>
1000 Minimunm number of ms between calls for more events
Source:

Extends

  • Readable

Members

(private) _rateLimiter :Promise

Rate limiting promise to ensure that events are not fetched too often, initially resolved to allow an immediate API call.
Type:
  • Promise
Source:

Methods

(private) _destroy() → {void}

Implementation of stream-internal `_destroy` function (v8.0.0 and later). Called by stream consumers to effectively stop polling via the public `destroy()`.
Source:
Returns:
Type
void

(private) _destroy() → {void}

Implementation of stream-internal `_destroy` function (v8.0.0 and later). Called by stream consumers to effectively stop polling via the public `destroy()`.
Source:
Returns:
Type
void

(private) _read() → {void}

Implementation of the stream-internal read function. This is called by the stream whenever it needs more data, and will not be called again until data is pushed into the stream.
Source:
Returns:
Type
void

(private) _read() → {void}

Implementation of the stream-internal read function. This is called by the stream whenever it needs more data, and will not be called again until data is pushed into the stream.
Source:
Returns:
Type
void

(private) cleanupDedupFilter(latestEvents) → {void}

Clean up the deduplication filter, to prevent it from growing too big and eating up memory. We look at the latest set of events returned and assume that any IDs not in that set don't need to be tracked for deduplication any more.
Parameters:
Name Type Description
latestEvents Array.<Object> The latest events from the API
Source:
Returns:
Type
void

(private) cleanupDedupFilter(latestEvents) → {void}

Clean up the deduplication filter, to prevent it from growing too big and eating up memory. We look at the latest set of events returned and assume that any IDs not in that set don't need to be tracked for deduplication any more.
Parameters:
Name Type Description
latestEvents Array.<Object> The latest events from the API
Source:
Returns:
Type
void

destroy() → {void}

Destroys the stream. Rough polyfill for `Readable#destroy`.
Source:
Returns:
Type
void

(private) doLongPoll() → {Promise}

Long poll for notification of new events. We do this rather than polling for the events directly in order to minimize the number of API calls necessary.
Source:
Returns:
Promise for testing pruposes
Type
Promise

(private) doLongPoll() → {Promise}

Long poll for notification of new events. We do this rather than polling for the events directly in order to minimize the number of API calls necessary.
Source:
Returns:
Promise for testing pruposes
Type
Promise

(private) fetchEvents() → {Promise}

Fetch the latest group of events and push them into the stream
Source:
Returns:
Promise for testing purposes
Type
Promise

(private) fetchEvents() → {Promise}

Fetch the latest group of events and push them into the stream
Source:
Returns:
Promise for testing purposes
Type
Promise

(private) getLongPollInfo() → {Promise}

Retrieve the url and params for long polling for new updates
Source:
Returns:
Promise for testing purposes
Type
Promise

(private) getLongPollInfo() → {Promise}

Retrieve the url and params for long polling for new updates
Source:
Returns:
Promise for testing purposes
Type
Promise

(private) retryPollInfo() → {void}

Retries long-polling after a delay. Does not attempt if stream is already destroyed.
Source:
Returns:
Type
void

(private) retryPollInfo() → {void}

Retries long-polling after a delay. Does not attempt if stream is already destroyed.
Source:
Returns:
Type
void