Merge pull request #462 from JJ-Cro/updateKeepAlive07_2025
feat(v4.1.16): add keepAlive, add lint script, edit lint errors
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "4.1.15",
|
"version": "4.1.16",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "4.1.15",
|
"version": "4.1.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "4.1.15",
|
"version": "4.1.16",
|
||||||
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
@@ -17,7 +17,8 @@
|
|||||||
"build:watch": "npm run clean && tsc --project tsconfig.build.json --watch",
|
"build:watch": "npm run clean && tsc --project tsconfig.build.json --watch",
|
||||||
"pack": "webpack --config webpack/webpack.config.js",
|
"pack": "webpack --config webpack/webpack.config.js",
|
||||||
"prepublish": "npm run build:clean",
|
"prepublish": "npm run build:clean",
|
||||||
"betapublish": "npm publish --tag beta"
|
"betapublish": "npm publish --tag beta",
|
||||||
|
"lint": "eslint src"
|
||||||
},
|
},
|
||||||
"author": "Tiago Siebler (https://github.com/tiagosiebler)",
|
"author": "Tiago Siebler (https://github.com/tiagosiebler)",
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
|
|||||||
@@ -5,4 +5,3 @@ export * from './response/v5-spreadtrading';
|
|||||||
export * from './shared';
|
export * from './shared';
|
||||||
export * from './shared-v5';
|
export * from './shared-v5';
|
||||||
export * from './websockets';
|
export * from './websockets';
|
||||||
|
|
||||||
|
|||||||
@@ -138,9 +138,17 @@ export default abstract class BaseRestClient {
|
|||||||
|
|
||||||
// If enabled, configure a https agent with keepAlive enabled
|
// If enabled, configure a https agent with keepAlive enabled
|
||||||
if (this.options.keepAlive) {
|
if (this.options.keepAlive) {
|
||||||
|
// Extract existing https agent parameters, if provided, to prevent the keepAlive flag from overwriting
|
||||||
|
// an existing https agent completely
|
||||||
|
const existingHttpsAgent = this.globalRequestOptions.httpsAgent as
|
||||||
|
| https.Agent
|
||||||
|
| undefined;
|
||||||
|
const existingAgentOptions = existingHttpsAgent?.options || {};
|
||||||
|
|
||||||
// For more advanced configuration, raise an issue on GitHub or use the "networkOptions"
|
// For more advanced configuration, raise an issue on GitHub or use the "networkOptions"
|
||||||
// parameter to define a custom httpsAgent with the desired properties
|
// parameter to define a custom httpsAgent with the desired properties
|
||||||
this.globalRequestOptions.httpsAgent = new https.Agent({
|
this.globalRequestOptions.httpsAgent = new https.Agent({
|
||||||
|
...existingAgentOptions,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
keepAliveMsecs: this.options.keepAliveMsecs,
|
keepAliveMsecs: this.options.keepAliveMsecs,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -751,6 +751,7 @@ export class WebsocketClient extends BaseWebsocketClient<
|
|||||||
|
|
||||||
if (!reqId) {
|
if (!reqId) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
'WS API response is missing reqId - promisified workflow could get stuck. If this happens, please get in touch with steps to reproduce. Trace:',
|
'WS API response is missing reqId - promisified workflow could get stuck. If this happens, please get in touch with steps to reproduce. Trace:',
|
||||||
{
|
{
|
||||||
wsKey,
|
wsKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user