Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.10.1: fix(#402) update ms passthru #404

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
v2.10.1: fix(#402) update ms passthru
tiagosiebler committed Feb 14, 2024
commit 6ce592f6e38cfdb3ec4bf816da3d105abdac6f95
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",
10 changes: 8 additions & 2 deletions src/websocket-client.ts
Original file line number Diff line number Diff line change
@@ -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}`,
@@ -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,
@@ -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}`,