Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitter-api-v2

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-api-v2 - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

12

changelog.md

@@ -0,7 +1,11 @@

1.6.2
-----
- Feat: Streams do now support auto-reconnection for the initial connection attempt
1.6.1
-----
- Feat: New option for creating streams, `autoConnect` that is `true` by default. Setting the value to `false` will cause the `TweetStream` object to be returned immediately (not in a `Promise`), because connection isn't awaited. #92
- Fix: `autoReconnectRetries`: Setting this params to `Infinity` no longer causes the stream reconnection attempts to be delayed to next event loop turn. #92
- Fix: Use `https.request(options)` instead of `https.request(url, options)`, because some people has outdated dependencies that overwrite native Node's exported function and break its signature. #94 #96
- Feat: Next retry timeout computation can be customized by using `.nextRetryTimeout` property of `TweetStream` instance, that is function taking a `tryOccurence` and returning the number of milliseconds to wait before trying to reconnect.
- Feat: New option for creating streams, `autoConnect` that is `true` by default ; Setting the value to `false` will cause the `TweetStream` object to be returned immediately (not in a `Promise`), because connection isn't awaited #92
- Fix: `autoReconnectRetries`: Setting this params to `Infinity` no longer causes the stream reconnection attempts to be delayed to next event loop turn #92
- Fix: Use `https.request(options)` instead of `https.request(url, options)`, because some people has outdated dependencies that overwrite native Node's exported function and break its signature #94 #96
- Feat: Next retry timeout computation can be customized by using `.nextRetryTimeout` property of `TweetStream` instance, that is function taking a `tryOccurence` and returning the number of milliseconds to wait before trying to reconnect

@@ -8,0 +12,0 @@ 1.6.0

@@ -8,4 +8,5 @@ /// <reference types="node" />

interface ITweetStreamError {
type: ETwitterStreamEvent.ConnectionError | ETwitterStreamEvent.TweetParseError | ETwitterStreamEvent.ReconnectError | ETwitterStreamEvent.DataError;
type: ETwitterStreamEvent.ConnectionError | ETwitterStreamEvent.TweetParseError | ETwitterStreamEvent.ReconnectError | ETwitterStreamEvent.DataError | ETwitterStreamEvent.ConnectError;
error: any;
message?: string;
}

@@ -12,0 +13,0 @@ export interface IConnectTweetStreamParams {

@@ -62,2 +62,3 @@ "use strict";

error: err,
message: 'Connection lost or closed by Twitter.',
});

@@ -85,3 +86,7 @@ this.onConnectionError();

this.emit(types_1.ETwitterStreamEvent.DataError, eventData);
this.emit(types_1.ETwitterStreamEvent.Error, { type: types_1.ETwitterStreamEvent.DataError, error: eventData });
this.emit(types_1.ETwitterStreamEvent.Error, {
type: types_1.ETwitterStreamEvent.DataError,
error: eventData,
message: 'Twitter sent a payload that is detected as an error payload.',
});
}

@@ -97,2 +102,3 @@ else {

error,
message: 'Failed to parse stream data.',
});

@@ -183,3 +189,16 @@ });

}
await this.reconnect();
// Make the connection
this.unbindTimeouts();
try {
await this.reconnect();
}
catch (e) {
this.emit(types_1.ETwitterStreamEvent.ConnectError, 0);
this.emit(types_1.ETwitterStreamEvent.Error, {
type: types_1.ETwitterStreamEvent.ConnectError,
error: e,
message: 'Connect error - Initial connection just failed.',
});
this.makeAutoReconnectRetry(0);
}
return this;

@@ -228,3 +247,4 @@ }

type: types_1.ETwitterStreamEvent.ReconnectError,
error: new Error(`Reconnect error - ${retryOccurence + 1} attempts made yet.`),
error: e,
message: `Reconnect error - ${retryOccurence + 1} attempts made yet.`,
});

@@ -231,0 +251,0 @@ this.makeAutoReconnectRetry(retryOccurence);

export declare enum ETwitterStreamEvent {
Connected = "connected",
ConnectError = "connect error",
ConnectionError = "connection error",

@@ -4,0 +5,0 @@ ConnectionClosed = "connection closed",

@@ -7,2 +7,3 @@ "use strict";

ETwitterStreamEvent["Connected"] = "connected";
ETwitterStreamEvent["ConnectError"] = "connect error";
ETwitterStreamEvent["ConnectionError"] = "connection error";

@@ -9,0 +10,0 @@ ETwitterStreamEvent["ConnectionClosed"] = "connection closed";

{
"name": "twitter-api-v2",
"version": "1.6.1",
"version": "1.6.2",
"description": "Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc