Closed CharlyEmpereurmot closed 2 years ago
your script looks good, but actually you dont need to start a thread, because your main thread is not doing something, so you can call stream_data()
also directly.
as you say, the error 1011 of the connection is handled (and is not your fault), but during handling the exception an other error occurs. i fixed it now. the fix is included in the next update!
thanks for the good and complete report!
Thanks for the prompt answer and the advices! Good to see this is already fixed :)
Just to be sure ... this message in particular, this is also tackled by the recent fix? Or harmless? Can you please confirm that the stream uuid is NOT changing upon reconnection? (that's my current understanding and I rely on this behavior in my coding)
BinanceWebSocketApiSocket.start_socket(f728f3f2ab52-d04e-607b-65dc-9a1ccc98, ['kline_1d'], ['xrpusdt'] socket_id=b1259da0-b9d5-4d90-8e71-9a11ea28a59b recent_socket_id=b1259da0-b9d5-4d90-8e71-9a11ea28a59b - Sending payload - exit because its not the recent socket id! stream_id=f728f3f2ab52-d04e-607b-65dc-9a1ccc98, recent_socket_id=c8306dc6-cf6d-4135-8ae0-b26829e08e26
Thanks
yes, thats fine!
when you create a stream, then you receive a stream_id which is unique and never changes.
but every stream needs a valid socket and each socket has also an unique id and if one stream has more than one active sockets, then all sockets except the newest one are closing them self. thats what happend here. one socket exists because its not the recent one...
Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])
Select one:
Environment
What kind of internet connection do you have?
Average system load (CPU)
Hardware specification
Operating System?
Options
Which endpoint do you connect?
Python Version Requirement
Exact Python Version?
Pip Version?
Dependencies
pip_list.txt
UNICORN Binance WebSocket API Version?
Description of your issue
Hi,
When running the websockets stream I get this message in my logs:
Not sure how much of an error this one is, it seems to recover.
But then I also have this error that pops:
And this one also:
BinanceWebSocketApiSocket.start_socket(f728f3f2ab52-d04e-607b-65dc-9a1ccc98, ['kline_1d'], ['xrpusdt'] socket_id=b1259da0-b9d5-4d90-8e71-9a11ea28a59b recent_socket_id=b1259da0-b9d5-4d90-8e71-9a11ea28a59b - Sending payload - exit because its not the recent socket id! stream_id=f728f3f2ab52-d04e-607b-65dc-9a1ccc98, recent_socket_id=c8306dc6-cf6d-4135-8ae0-b26829e08e26
Then the problem I am seeing is that I have stopped listening to the websokcets at some point.
Here is a minimal version of the code I'm using:
Can you please indicate if I am indeed seeing bugs, or if I'm just mis-using the library? Is this the correct way to stream websockets? I am using this code with 40 pairs, each using a single period.
Thank you very much