Ethereum Binance’s Websockets problem in the Chrome
browser
Introduction
The following article faces a common problem encountered by users of the Ethereum Blockchain and associated bees, including Binance Websockets API. The problem is that the WSS: //stream.binance: 9443
is used to establish a websocket connection to the exchange of binance is treated as https instead of http instead of http (or even FTP) on Google Chrome and Mozilla Firefox Browser .
The problem
When using the Binance Websockets API, it is essential to use a HTTP or HTTPS connection to ensure that the data sent on the network are adequately authenticated and validated. The predefined WSS: //stream.binance.com: 9443
Use Cryptography TLS (Transport Layer Security) URL URL. of Chrome at a different end point.
The solution
To solve this problem, it is necessary to use an alternative connection URL that bypass the TLS redirection. Here’s how to change your code:
`Javascript
import from ‘socket.io-client’;
Const Socket = I (‘
// or for FTP (file transfer protocol)
Const Ftpurl = ‘Ftp://stream.binance.com:9443’;
Socket.on (‘Connect’, () => {
Console.log (‘Connected to Binance Websockets Api’);
});
``
Modified code test
Try to perform your modified code in a Chrome browser and check that you can connect correctly to the Binance Websockets. If you are still finding problems, make sure that:
- You have the latest version of Chrome installed.
2
Conclusion
Using an alternative connection URL, such as HTTP or FTP, it is necessary to correctly establish a websocket connection to the exchange of Binance without meeting the HTTPS redirection problem in Chrome and Firefox browsers.