v3.7.7: minor docs improvements. support for recvWindow for ws client

This commit is contained in:
tiagosiebler
2023-12-11 09:29:59 +00:00
parent abd786eec9
commit e0db4edddb
4 changed files with 37 additions and 30 deletions

View File

@@ -98,6 +98,8 @@ export interface WSClientConfigurableOptions {
pongTimeout?: number;
pingInterval?: number;
reconnectTimeout?: number;
/** Override the recv window for authenticating over websockets (default: 5000 ms) */
recvWindow?: number;
restOptions?: RestClientOptions;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
requestOptions?: any;

View File

@@ -123,6 +123,7 @@ export class WebsocketClient extends EventEmitter {
pongTimeout: 1000,
pingInterval: 10000,
reconnectTimeout: 500,
recvWindow: 5000,
fetchTimeOffsetBeforeAuth: false,
...options,
};
@@ -739,7 +740,9 @@ export class WebsocketClient extends EventEmitter {
? (await this.restClient?.fetchTimeOffset()) || 0
: 0;
const signatureExpiresAt = Date.now() + timeOffset + 5000;
const recvWindow = this.options.recvWindow || 5000;
const signatureExpiresAt = Date.now() + timeOffset + recvWindow;
const signature = await signMessage(
'GET/realtime' + signatureExpiresAt,