I use this code:
const ws = new WebSocket(`wss://stream.binance.com:9443/ws`);
const stream = JSON.stringify({
method: "SUBSCRIBE",
params: ["btcusdt@aggTrade"],
id: 1,
});
ws.on("open", () => {
console.log(`Connection opened!`);
ws.send(stream);
});
I have a couple of questions:
- I read in docs: Raw streams are accessed at /ws/. I can I do that?
- After I use
ws.send(stream);
how can I get the response?