Constructor
new StreamClient(config)
- Source:
Initializes the client
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | Configuration for client Properties
|
Fires:
Extends
- EventEmitter
Methods
(async) connect(config) → {Promise.<void>}
- Source:
- See:
-
- retriableStatus
Connect to twitter stream and emit events.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | Configuration for connection Properties
|
Returns:
Promise that resolves on disconnect -- the Promise rejects if the number of reconnects exceeds the max or an irrecoverable error occurs -- the Promise resolves with that last error returned. Error object defines .reconnects if reconnects are exceeded
- Type
- Promise.<void>
disconnect() → {boolean}
- Source:
Disconnects an active request if any
Returns:
Returns true if there is a request to disconnect
- Type
- boolean
Events
tweet
- Source:
Triggered upon connected stream receiving a tweet
Type:
- Object
heartbeat
- Source:
Triggered upon connected stream receiving a heartbeat
stream-error
- Source:
Triggered when on api-level stream errors (misformatted JSON, etc.)
Type:
- Object
api-errors
- Source:
Provides twitter error messages as JSON objects
Type:
- Object
other
- Source:
Triggered upon connected stream receiving unexpected JSON
Type:
- Object
connected
- Source:
Triggered on stream connection
reconnect
- Source:
Triggered before stream reconnect and provides the wait time till reconnect
Type:
- number
disconnected
- Source:
Triggered when manually disconnecting client stream