Skip to content

Commit 2bb5172

Browse files
authored
Merge pull request #404 from tiagosiebler/msupdate
v2.10.1: fix(#402) update ms passthru
2 parents 58727ff + 6ce592f commit 2bb5172

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "binance",
3-
"version": "2.10.0",
3+
"version": "2.10.1",
44
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/websocket-client.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,9 @@ export class WebsocketClient extends EventEmitter {
15831583
const lowerCaseSymbol = symbol.toLowerCase();
15841584
const streamName = 'depth';
15851585
const wsKey = getWsKeyWithContext(market, streamName, lowerCaseSymbol);
1586-
const updateMsSuffx = updateMs === 100 ? `@${updateMs}ms` : '';
1586+
1587+
const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';
1588+
15871589
return this.connectToWsUrl(
15881590
this.getWsBaseUrl(market, wsKey) +
15891591
`/ws/${lowerCaseSymbol}@${streamName}${levels}${updateMsSuffx}`,
@@ -1599,6 +1601,8 @@ export class WebsocketClient extends EventEmitter {
15991601
*
16001602
* - Spot: https://binance-docs.github.io/apidocs/spot/en/#diff-depth-stream
16011603
* - USDM Futures: https://binance-docs.github.io/apidocs/futures/en/#diff-book-depth-streams
1604+
*
1605+
* Use getContextFromWsKey(data.wsKey) to extract symbol from events
16021606
*/
16031607
public subscribeDiffBookDepth(
16041608
symbol: string,
@@ -1614,7 +1618,9 @@ export class WebsocketClient extends EventEmitter {
16141618
lowerCaseSymbol,
16151619
String(updateMs),
16161620
);
1617-
const updateMsSuffx = updateMs === 100 ? `@${updateMs}ms` : '';
1621+
1622+
const updateMsSuffx = typeof updateMs === 'number' ? `@${updateMs}ms` : '';
1623+
16181624
return this.connectToWsUrl(
16191625
this.getWsBaseUrl(market, wsKey) +
16201626
`/ws/${lowerCaseSymbol}@${streamName}${updateMsSuffx}`,

0 commit comments

Comments
 (0)