Skip to content

Commit

Permalink
v2.10.1: fix(#402) update ms passthru
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Feb 14, 2024
1 parent 58727ff commit 6ce592f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binance",
"version": "2.10.0",
"version": "2.10.1",
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
10 changes: 8 additions & 2 deletions src/websocket-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,9 @@ export class WebsocketClient extends EventEmitter {
const lowerCaseSymbol = symbol.toLowerCase();
const streamName = 'depth';
const wsKey = getWsKeyWithContext(market, streamName, lowerCaseSymbol);
const updateMsSuffx = updateMs === 100 ? `@${updateMs}ms` : '';

const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';

return this.connectToWsUrl(
this.getWsBaseUrl(market, wsKey) +
`/ws/${lowerCaseSymbol}@${streamName}${levels}${updateMsSuffx}`,
Expand All @@ -1599,6 +1601,8 @@ export class WebsocketClient extends EventEmitter {
*
* - Spot: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
* - USDM Futures: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
*
* Use getContextFromWsKey(data.wsKey) to extract symbol from events
*/
public subscribeDiffBookDepth(
symbol: string,
Expand All @@ -1614,7 +1618,9 @@ export class WebsocketClient extends EventEmitter {
lowerCaseSymbol,
String(updateMs),
);
const updateMsSuffx = updateMs === 100 ? `@${updateMs}ms` : '';

const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';

return this.connectToWsUrl(
this.getWsBaseUrl(market, wsKey) +
`/ws/${lowerCaseSymbol}@${streamName}${updateMsSuffx}`,
Expand Down

0 comments on commit 6ce592f

Please sign in to comment.