Ethereum: Binance WSS api url is being treated as HTTPS on both Google Chrome and Firefox

Ethereum Binance WebSockets API Issue on Chrome

Introduction

This article discusses a common issue faced by users of the Ethereum blockchain and its associated APIs, including the Binance WebSockets API. The issue is that the URL endpoint wss://stream.binance.com:9443 used to establish a WebSocket connection to the Binance exchange is treated as HTTPS, not HTTP (or even FTP) by the Google Chrome and Mozilla Firefox browsers.

Issue

When using the Binance WebSockets API, it is important to use an HTTP or HTTPS connection to ensure that data sent over the network is properly authenticated and validated. The default WebSocket URL wss://stream.binance.com:9443 uses Transport Layer Security (TLS) encryption, which encrypts all traffic between the client and the server, but also redirects all requests from Chrome’s internal proxy cache to another endpoint.

Solution

To resolve this issue, you need to use an alternative connection URL that avoids the TLS redirect. Here’s how to modify the code:

`javascript

import io from 'socket.io-client';

const socket = io('

// or FTP (for File Transfer Protocol)

constant ftpUrl = 'ftp://stream.binance.com:9443';

socket. on('connect', () => {

console. log('Connected to Binance WebSockets API');

});

Modified Code Check

Ethereum: Binance WSS api url is being treated as HTTPS on both Google Chrome and Firefox

Try running the modified code in Chrome and see if you can successfully connect to the Binance WebSockets API. If the issues persist, make sure that:

  • You have the latest version of Chrome installed.
  • The “wss://stream.binance.com:9443” endpoint is not blocked or restricted by any security measures.

Conclusion

By using an alternative connection URL, such as HTTP or FTP, you should be able to successfully establish a WebSocket connection to the Binance exchange without encountering the HTTPS redirection issue in Chrome and Firefox.

Metamask Only Contract Owner

Tags: