I'm having trouble trying to connect with websocket server.
I need to subscribe to get the current price of EUR/USD but I keep reciving this object : {topic: "keepalive"}.
It should return the price and the latest timestamp;
This is my code :
import { w3cwebsocket as W3CWebSocket } from "websocket";
export default function LogIn() {
const client = new W3CWebSocket('ws://stream.tradingeconomics.com/?client=guest:guest');
useEffect(()=>{
client.onopen = function(e) {
console.log("Connection established!");
client.send(JSON.stringify({topic: "subscribe", to: "EURUSD:CUR"}))
client.onmessage = function(e) { console.log(e); };
};
},[])
I would appreciate the help !