WebSocket API returns wrong weight

When I use this code the response returns count: 2 instead of 1 as written in the documenttion. What’s wrong?

ws.on("open", () => {
  ws.send(
    JSON.stringify({
      id: Date.now(),
      method: "time",
    })
  );
});

ws.on("message", data => {
  console.log(JSON.parse(data.toString()));
});

Connecting to WebSocket API costs 1 weight. Then you immediately send a "time" request which costs 1 more weight. Thus you end up seeing 2 reported in request response.

Weight usage is reported in HTTP headers during connection, but unfortunately connection headers are not available in "open" events.

2 Likes

Hello, what’s in the documentation for method: "time" response, is only an example.
To understand more about Rate Limits, please consult at Binance API Documentation.

1 Like