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",
|
||||
"version": "4.1.15",
|
||||
"version": "4.1.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "bybit-api",
|
||||
"version": "4.1.15",
|
||||
"version": "4.1.16",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^1.7.9",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
@@ -17,7 +17,8 @@
|
||||
"build:watch": "npm run clean && tsc --project tsconfig.build.json --watch",
|
||||
"pack": "webpack --config webpack/webpack.config.js",
|
||||
"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)",
|
||||
"contributors": [],
|
||||
|
||||
@@ -5,4 +5,3 @@ export * from './response/v5-spreadtrading';
|
||||
export * from './shared';
|
||||
export * from './shared-v5';
|
||||
export * from './websockets';
|
||||
|
||||
|
||||
@@ -138,9 +138,17 @@ export default abstract class BaseRestClient {
|
||||
|
||||
// If enabled, configure a https agent with keepAlive enabled
|
||||
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"
|
||||
// parameter to define a custom httpsAgent with the desired properties
|
||||
this.globalRequestOptions.httpsAgent = new https.Agent({
|
||||
...existingAgentOptions,
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: this.options.keepAliveMsecs,
|
||||
});
|
||||
|
||||
@@ -751,6 +751,7 @@ export class WebsocketClient extends BaseWebsocketClient<
|
||||
|
||||
if (!reqId) {
|
||||
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:',
|
||||
{
|
||||
wsKey,
|
||||
|
||||
Reference in New Issue
Block a user