Ethereum Binance websockets API Issue in Chrome Browser
Introduction
The Following Article Addresses A Common Issue Experienced by Users of the Ethereum Blockchain and Its Associated APIS, Including The Binance Website API. The Problem is that the wss: //stream.binance.com: 9443
Url endpoint Used to Establish a Websocket Connection to the Binance Exchange is Being Treated As HTTPS Insead of HTTP (OR Even FTP) On Both Google Chrome and Mozilla Firef Browsers.
The issue
When using the binance websockets API, it’s essential to use an http or https connection to ensure that the data sent over the network is properly authenticated and validated. The default website URL wss: //stream.binance.com: 9443
Uses Transport Layer Security (TLS) encryption, which encrypts all traffic between the client and server but also redirects all requests from chrome’s internal proxy.
The Solution
To resolve this issue, you need to use an alternative connection url that bypasses the tls redirection. Here’s how to modify your code:
`Javascript
import io from ‘socket.io-client’;
Conn socket = io (‘
// or for FTP (File Transfer Protocol)
Constpurl = ‘ftp://stream.binance.com:9443’;
Socket.on (‘Connect’, () => {
console.log (‘connected to binance websockets api’);
});
`
Testing the modified code
Try Running your modified code in a chrome browser, and verify that you can successully connect to the binance websockets API. If you’re still experienced issues, Ensure That:
- You have the latest version of Chrome installed.
- The
wss: //stream.binance.com: 9443
endpoint is not blocked or restricted by any security features.
Conclusion
By Using An Alternative Connection URL, Such As HTTP or FTP, You Should Be Able to Successully Establish A Websocket Connection to the Binance Exchange Without Encountering the HTTPS Redirection Issue in Chrome and Firefox Browsers.