bnb-chain / java-sdk

Apache License 2.0
127 stars 86 forks source link

Websocket data stream url not connected #148

Closed saahmadi closed 11 months ago

saahmadi commented 1 year ago

i`m trying to connect with wss://dex.binance.org/api but not working

STdevK commented 1 year ago

The .org domain is a domain of the (legacy) Binance Chain - predecessor of the currently widely used Binance Smart Chain network. Try the following endpoints instead: wss://stream.binance.com:9443/ws wss://stream.binance.com:443/ws

If you want to use WS API of the Binance exchange (located at the .com domain), it's published at wss://stream.binance.com:9443 (docs) and you can subscribe to trade channels in the format of @trade (docs).

saahmadi commented 1 year ago

thanks for your response but i want to use websocket to listen any address transfer event please look at following example from binance const accountAndOrdersFeeds = new WebSocket("wss://dex.binance.org/api/ws/"); https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/ws-connection in the past worked but right now it doesnt connect.

deepcrazy commented 1 year ago

Hi there, With the decommission of DEX, the related service had been shutdown, the doc is outdated and will be updated soon. Alternatively, The most convenient way is to use these apis. https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/block-service#apiv1blocks https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/block-service#apiv1txs (use Transfer for type parameter).

Another way can be this example: https://github.com/bnb-chain/java-sdk/blob/master/src/test/java/com/binance/dex/api/client/examples/BinanceDexWSApiExample.java

In case if you face issue with java-sdk, Kindly provide more details like your code snippet and error logs so as our team can directly look into it.