java-binance-api icon indicating copy to clipboard operation
java-binance-api copied to clipboard

Web Socket - No Output

Open spapapan opened this issue 7 years ago • 3 comments

I am trying to run:

		BinanceSymbol symbol = new BinanceSymbol("ETHBTC");
		Session session = (new BinanceApi()).websocketTrades(symbol, new BinanceWebSocketAdapterAggTrades() {
		    @Override
		    public void onMessage(BinanceEventAggTrade message) { 
		        System.out.println(message.toString());
		    }
		});
		try { Thread.sleep(5000); } catch (InterruptedException e) {}
		session.close();

But I don't get any output. There are no errors and the program never stop. Is this somehow my fault?

spapapan avatar Jan 26 '18 13:01 spapapan

That just means nothing happened during those 5 seconds on that particular market. Try increasing time interval or even remove the last 2 lines - it will watch market till the user interrupts it

wcrbrm avatar Jan 27 '18 12:01 wcrbrm

That's not the case. I have tried it many times and I checked the market. I also tried the other class BinanceWebSocketAdapterDepth but still I don't get anything back.

spapapan avatar Jan 27 '18 15:01 spapapan

well, I've double checked the code is valid, I've added it as groovy example and it works for me. May me it is somehow connected with dependencies managed manually like described in your previous ticket

wcrbrm avatar Jan 27 '18 17:01 wcrbrm