S
S
smartbe2021-02-23 17:15:47
Node.js
smartbe, 2021-02-23 17:15:47

Web sockets - does not work with the ws library?

I have such code

import WebSocket from 'ws';
const ws = new WebSocket(`wss://stream.binance.com:9443/ws/${symbol}@depth${level}@100ms`);


Next, I make a bundle with the help of webpack. I

try to run the bundle with the node bundle.js command, and there the error ws does not work in the browser. Browser clients must use the native WebSocket object

I'm running the file through the node, and not through the browser, why can I swear?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question