Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

319
Visualizações
Websocket connection to binance api returns error

I wanted to test websocket connection to binance api wss://testnet-dex.binance.org/api/ws. But whenever I run js script I am getting error as response from ws.

Script looks like that

const WebSocket = require('ws');

const conn = new WebSocket("wss://testnet-dex.binance.org/api/ws");
conn.onopen = function(evt) {
    conn.send(JSON.stringify({ method: "subscribe", topic: "trades", symbols: ["ETH_BNB"] })); // I did try using as an symbols 'BNB_USDT.B-B7C', but got the same error
}
conn.onmessage = function(evt) {
    console.info('received data', evt.data);
};
conn.onerror = function(evt) {
    console.error('an error occurred', evt.data);
};

And whenever script is run I am getting

received data {"method":"subscribe","error":{"error":"Invalid symbol(s)"}}

received data {"method":"subscribe","error":{"error":"Symbols [BNB_USDT.B-B7C] are not valid for topic: trades, for user: 100.x.x.x:3333 \u003e 100.xx.x.x:59558"}}

It seems like I am getting error because I did write wrong symbol. But I used multiple symbols, and all of them produced the same error. Not saying that I just copy/paste this code fron binance documentation https://docs.binance.org/api-reference/dex-api/ws-streams.html

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I've made a Real-Time Crypto Price Tracker. Check it out here.

about 4 years ago · Juan Pablo Isaza Relatório

0

The .org domain is a domain of the (legacy) Binance Chain - predecessor of the currently widely used Binance Smart Chain network.

If you want to use WS API of the Binance exchange (located at the .com domain), it's published at wss://stream.binance.com:9443 (docs) and you can subscribe to trade channels in the format of <symbol>@trade (docs).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda