'How can i connect Huobi websocket from client browser

When I try to connect my React client to Huobi websocket, connection immediately closing.

In nodejs I can connect to Huobi websocket without any configuration.

I've tried at postman and it connects.

Tried at https://www.piesocket.com/websocket-tester but it did throw same error and closed immediately. This is error: huobi websocket error at client

This is the sample code for both nodejs and clientside:

const websocket = new WebSocket("wss://api.huobi.pro/ws");

websocket.onopen = () => {
  console.log("connected");
  subscribe(websocket);
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source