Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about custom keep-alive implementation #986

Open
yaroshoris opened this issue May 10, 2024 · 0 comments
Open

Question about custom keep-alive implementation #986

yaroshoris opened this issue May 10, 2024 · 0 comments

Comments

@yaroshoris
Copy link

Hi folks, I would like to implement Binance User Data Stream using websocket-client.

Binance has a specific way for User Data Websocket Streams, in a nutshell:

  1. You need to obtain "listenKey" doing POST to their API.
  2. Binance return listen key and from this moment you have 60 min session for getting updates about your user data records (orders, balances, etc...).
  3. You can initialise WebSocketApp "wss:+stream+your listenKey".
  4. During this time, you need to update your "listenKey" doing POST again (this can extend lifetime of the key on 60 min more).

I can't use on_message because if there will be no records in account in 60 min interval - this method woun't be called.

My question mostly about a mechanism how to properly implement that.

I have some thouths:
Doing this procedure from the main thread and implement custom logic aside websocket-client.

So, any ideas how to implement it inside websocket-client?

Thanks, much appreciate any involvings in this question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant