binance-us / binance-us-api-docs

Official Documentation for the Binance US APIs and Streams
407 stars 170 forks source link

Correctly constructed JSON objects unable to be read by binanceAPI. Error code 3 returned #34

Closed JacksonHR2000 closed 3 years ago

JacksonHR2000 commented 3 years ago

This JSON object

var paramJSON = {
    "method": "SUBSCRIBE",
    "params": [
        "btcusd@kline_1m",
        "ethusd@kline_1m",
        "solusd@kline_1m",
        "dogeusd@kline_1m",
        "adausd@kline_1m",
        "vetusd@kline_1m",
        "bnbusd@kline_1m"
    ],
    "id": "10"
}

is unable to be read by the Binance parser, despite being a valid JSON object. I have also tried sending the same message with the parenthesis removed from the ID, but that does not work either.

I am using the inbuilt javascript WebSocket class to handle my class, and I am sending this message to a connected stream using this code: stream.send(paramJSON)

Furthermore, I have also tried sending the example message from this project's documentation, but that is also returned with error code 3.

var paramJSON = {
  "method": "SUBSCRIBE",
  "params": [
    "btcusdt@aggTrade",
    "btcusdt@depth"
  ],
  "id": 1
}

I am certain that I am sending these JSON files over a valid connection. What could be going on here?

JacksonHR2000 commented 3 years ago

Issue fixed. I was not sending my JSON as a string.

rorysan333 commented 3 years ago

Thank you very much

Sent from the all new AOL app for iOS

On Friday, June 25, 2021, 1:50 PM, JacksonHR2000 @.***> wrote:

Issue fixed. I was not sending my JSON as a string.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.