joaopsilva / binance-java-api

binance-java-api is a lightweight Java library for the Binance API, supporting synchronous and asynchronous requests, as well as event streaming using WebSockets.
212 stars 803 forks source link

Cannot close BinanceApiWebSocketClient #6

Open tonyth00 opened 6 years ago

tonyth00 commented 6 years ago

Using onAggTradeEvent(). Tried closing the stream using close() but the web socket client keeps sending callbacks.

pantoea commented 6 years ago

Try webSocket.close(); wsClient.close();

dman-sol commented 3 years ago

WebSocket.close () does not work for me; If you do something webSocketClient.onAggTradeEvent((fromToken + toToken).toLowerCase(), response -> System.out.println(response.getPrice())).close(); then I get an exceptionjava.lang.NullPointerException: Parameter specified as non-null is null: method okhttp3.WebSocketListener.onClosed, parameter reason.