Merge pull request #13 from tiagosiebler/ping

v1.1.1: fix(#10) ping syntax for websockets
This commit is contained in:
Tiago
2023-04-26 09:27:12 +01:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "bitget-api", "name": "bitget-api",
"version": "1.1.0", "version": "1.1.1",
"description": "Node.js connector for Bitget REST APIs and WebSockets, with TypeScript & end-to-end tests.", "description": "Node.js connector for Bitget REST APIs and WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@@ -331,7 +331,7 @@ export class WebsocketClient extends EventEmitter {
this.clearPongTimer(wsKey); this.clearPongTimer(wsKey);
this.logger.silly('Sending ping', { ...LOGGER_CATEGORY, wsKey }); this.logger.silly('Sending ping', { ...LOGGER_CATEGORY, wsKey });
this.tryWsSend(wsKey, JSON.stringify({ op: 'ping' })); this.tryWsSend(wsKey, 'ping');
this.wsStore.get(wsKey, true).activePongTimer = setTimeout(() => { this.wsStore.get(wsKey, true).activePongTimer = setTimeout(() => {
this.logger.info('Pong timeout - closing socket to reconnect', { this.logger.info('Pong timeout - closing socket to reconnect', {