question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binance Futures Testnet Websocket

See original GitHub issue

Hello, I want to use a websocket for BinanceFutures Testnet. However, I could not establish a connection. The code block is as follows. Where am I making a mistake?

The value of startResult returns false.

var client = new BinanceClient(new Binance.Net.Objects.Spot.BinanceClientOptions
{
     FuturesUsdtBaseAddress = "wss://stream.binancefuture.com/",
     ApiCredentials = new ApiCredentials(_options.ApiKey, _options.ApiSecret)
});

var startResult = client.FuturesUsdt.UserStream.StartUserStream();
if (!startResult.Success) throw new Exception($"Failed to start user stream: {startResult.Error}");

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JKorfcommented, Oct 6, 2020

Oh I see what is wrong. You’re passing the websocket address to the Rest api client. The BinanceClient class is used to communicate with the Rest api, the BinanceSocketClient class is used to connect to streams.

When using the BinanceClient to start the user stream (which is the correct thing to do before actually subscribing with the socket client) you should set the base address property in the options to the Rest address of the testnet, not the websocket address.

0reactions
emin-karadagcommented, Oct 9, 2020

@JKorf I did what you said yes and it worked. Thank you. 😃)

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebSocket URL for user data stream on testnet
The documentation says that the websocket url for the testnet is wss://stream.binancefuture.com . However it seems like it only works for market ...
Read more >
Change Log – Binance API Documentation
The base websocket endpoint is changed as wss://stream.binancefuture.com, the old one (wss://testnet.binancefuture.com) is no longer in service.
Read more >
How to Test My Functions on Binance Testnet
1. Log in to your Binance testnet account on the Binance Futures Testnet. · 2. Scroll down and click [API Key] and you...
Read more >
binance-testnet
An unofficial Python API to use the Binance Websocket API`s (com+testnet, ... com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a easy, ...
Read more >
re-unicorn-binance-websocket-api
An unofficial Python API to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found