I dont know why the data is not getting printed to the console
package com.binance.connector.futures.client.App;
import com.binance.connector.futures.client.impl.UMFuturesClientImpl;
import com.binance.connector.futures.client.impl.UMWebsocketClientImpl;
import io.github.cdimascio.dotenv.Dotenv;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.LinkedHashMap;
public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class);
protected static final Dotenv config = Dotenv.configure().load();
private static final String API_KEY = config.get("BINANCE.APIKEY");
private static final String SEC_KEY = config.get("BINANCE.SECKEY");
static UMFuturesClientImpl client = new UMFuturesClientImpl(API_KEY, SEC_KEY);
static UMWebsocketClientImpl websocketClient = new UMWebsocketClientImpl();
public static void main(String[] args) {
LinkedHashMap<String, Object> params = new LinkedHashMap<>();
ListenKeyRenewer keyRenew = new ListenKeyRenewer();
client.setProxy(Util.proxyMaker(config.get("PROXY.HOSTNAME"), Integer.parseInt(config.get("PROXY.PORT")),
config.get("PROXY.USERNAME"), config.get("PROXY.PASSWORD")));
String listenKey = client.userData().createListenKey();
websocketClient.listenUserStream(listenKey, System.out::println);
keyRenew.start();
}
}
The output is
2023-04-01 10:55:04.824[1682339304824] | INFO | main | c.b.c.f.client.utils.RequestHandler - POST https://fapi.binance.com/fapi/v1/listenKey
2023-04-01 10:55:05.607[1682339305607] | INFO | main | c.b.c.f.c.utils.WebSocketConnection - [Connection 1] Connecting to fstream.binance.com/ws/%7B%22listenKey%22:%22tjkR7BvmQfwP7eGJlld2gnjSTLLMjlKGiBmtvcZVmY1Tse5nuVY0pmBGExxIgVjX%22%7D
2023-04-01 10:55:06.798[16802339306798] | INFO | OkHttp https://fstream.binance.com/... | c.b.c.f.c.utils.WebSocketConnection - [Connection 1] Connected to Server