XChange
XChange copied to clipboard
BinanceStream module futures example > invalid WebSocket Extension handshake for "permessage-deflate"
Is not working https://github.com/knowm/XChange/blob/develop/xchange-stream-binance/src/test/java/info/bitrich/xchangestream/binance/BinanceLiveFutureSubscriptionExample.java
code=
ExchangeSpecification spec =
StreamingExchangeFactory.INSTANCE
.createExchange(BinanceFutureStreamingExchange.class)
.getDefaultExchangeSpecification();
BinanceFutureStreamingExchange exchange =
(BinanceFutureStreamingExchange) StreamingExchangeFactory.INSTANCE.createExchange(spec);
// First, we subscribe only for one currency pair at connection time (minimum requirement)
ProductSubscription subscription =
ProductSubscription.create()
.addTrades(CurrencyPair.BTC_USDT)
.addOrderbook(CurrencyPair.BTC_USDT)
.build();
// Note: at connection time, the live subscription is disabled
exchange.connect(subscription).blockingAwait();
pom.xml
<dependency>
<groupId>org.knowm.xchange</groupId>
<artifactId>xchange-stream-binance</artifactId>
<version>5.0.14-SNAPSHOT</version>
</dependency>
Gives next error
2022-03-14 11:37:11 [INFO] - Connecting to wss://fstream.binance.com/stream?streams=btcusdt@depth/btcusdt@trade
2022-03-14 11:37:13 [ERROR] - WebSocket client [id: 0x357d7484, L:/192.168.2.101:58816 - R:fstream.binance.com/52.199.148.88:443] encountered exception (CodecException - invalid WebSocket Extension handshake for "permessage-deflate"). Closing
io.netty.handler.codec.CodecException: invalid WebSocket Extension handshake for "permessage-deflate"