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.

Upgrade to 1.34.0 (and websockets 10) sockets connect, but no data received

See original GitHub issue

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • I have searched for other issues with the same problem or similar feature requests.

#196 is very loosely related.

Select one:

  • Bug
  • Feature Request
  • Technical Help
  • Other

Environment

  • Are you using the module on a VPS or other Cloud hosting?
  • Are you using the module on a Raspberry Pi?

What kind of internet connection do you have?

Cable 100U/500D

Average system load (CPU)

8 core, 4% user, 5% system

Hardware specification

MacBook Pro 17" 

Operating System? (include version)

  • macOS 11.6
  • Windows
  • Linux (include flavour)

Options

  • stream_buffer
  • process_stream_data

Which endpoint do you connect?

binance.com-futures

Python Version Requirement

  • I am using Python 3.7 or above

Exact Python Version?

(binance.venv) jlixfeld@BlackBox binance % python --version
Python 3.8.9
(binance.venv) jlixfeld@BlackBox binance % python3 --version
Python 3.8.9
(binance.venv) jlixfeld@BlackBox binance % 

Pip Version?

(binance.venv) jlixfeld@BlackBox binance % pip3 --version
pip 21.2.4 from /Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/pip (python 3.8)
(binance.venv) jlixfeld@BlackBox binance % 

Dependencies

Run pip list > pip_list.txt and upload the file.

list.txt

UNICORN Binance WebSocket API Version?

(binance.venv) jlixfeld@BlackBox binance % python ./get_used_module_version.py 
1.34.0
(binance.venv) jlixfeld@BlackBox binance % 

Description of your issue

1.34.0 does not receive data while using websockets 10. Downgrading to websockets 9.1 works fine.

Attaching first 500 lines of debugs for sockets 9.1 and sockets 10.0 run.

ws10.txt ws91.txt

Websockets 10:
In [4]: vars.ubwam.print_summary()
====================== unicorn-binance-websocket-api_1.34.0-python_3.8.9 ======================
 exchange: binance.com-futures
 uptime: 4m:25s since 2021-09-21, 12:13:45 UTC
 streams: 8
 active_streams: 8
 subscriptions: 8
 current_receiving_speed: 0 B/s
 average_receiving_speed: 0.0 B/s (per day 0.0 gB)
 highest_receiving_speed: 0 B/s (reached at 2021-09-21, 12:13:45 UTC)
 total_receives: 0
 total_received_bytes: 0 (0 B)
 total_transmitted_payloads: 7
 stream_buffer_maxlen: None
 process_ressource_usage: cpu=4.9%, memory=90.48 mB, threads=29
 ---------------------------------------------------------------------------------------------
               stream_id              |   stream_label  |  last  |  average  |  peak  | recon
 ---------------------------------------------------------------------------------------------
 d05fa829-8486-4ec1-9ec7-fcce3a0ac908 | kline_1m        |      0 |       0.0 |      0 |      0 
 6516a09a-f889-4260-bfc6-9840cccbb1d6 | kline_3m        |      0 |       0.0 |      0 |      0 
 e174ee3e-e7eb-4265-b6ef-4d3b047e1860 | kline_5m        |      0 |       0.0 |      0 |      0 
 37f4c5d5-458c-470a-8ddb-fecb33444c3a | kline_15m       |      0 |       0.0 |      0 |      0 
 e79dca7d-9ba6-40f2-9af1-2736f94e7a85 | kline_30m       |      0 |       0.0 |      0 |      0 
 f430889a-3517-414f-b228-dd352271c9d1 | kline_1h        |      0 |       0.0 |      0 |      0 
 45d8780d-5704-432d-beea-bd6306aea425 | ticker          |      0 |       0.0 |      0 |      0 
 55e123cd-d0c6-49dc-a740-83dcc436c6a2 | userdata        |      0 |       0.0 |      0 |      0 
 ---------------------------------------------------------------------------------------------
 all_streams                                            |      0 |       0.0 |      0 |      0 
===============================================================================================


In [5]:
Downgrade to websockets 9.1:

Downgrade output provided, as well as print_summary() to illustrate input after downgrade.

(binance.venv) jlixfeld@BlackBox binance % pip uninstall websockets
Found existing installation: websockets 10.0
Uninstalling websockets-10.0:
  Would remove:
    /Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets-10.0.dist-info/*
    /Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/*
  Would not remove (outside of prefix):
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/__init__.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/__main__.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/auth.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/client.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/connection.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/datastructures.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/exceptions.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/extensions/__init__.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/extensions/base.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/extensions/permessage_deflate.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/frames.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/headers.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/http.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/http11.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/imports.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/__init__.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/auth.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/client.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/compatibility.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/framing.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/handshake.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/http.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/protocol.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/legacy/server.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/server.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/streams.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/typing.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/uri.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/utils.cpython-38.pyc
    /Users/jlixfeld/Library/Caches/com.apple.python/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/websockets/version.cpython-38.pyc
Proceed (Y/n)? 
  Successfully uninstalled websockets-10.0
(binance.venv) jlixfeld@BlackBox binance % pip install websockets==9.1                                                                                                                          
Collecting websockets==9.1
  Using cached websockets-9.1-cp38-cp38-macosx_10_9_x86_64.whl (88 kB)
Installing collected packages: websockets
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
unicorn-binance-websocket-api 1.34.0 requires websockets==10.0, but you have websockets 9.1 which is incompatible.
Successfully installed websockets-9.1
(binance.venv) jlixfeld@BlackBox binance % 

In [1]: vars.ubwam.print_summary()
====================== unicorn-binance-websocket-api_1.34.0-python_3.8.9 ======================
 exchange: binance.com-futures
 uptime: 9 seconds since 2021-09-21, 12:20:47 UTC
 streams: 8
 active_streams: 8
 subscriptions: 8
 current_receiving_speed: 7.5 kB/s
 average_receiving_speed: 3.87 kB/s (per day 0.32 gB)
 highest_receiving_speed: 9.49 kB/s (reached at 2021-09-21, 12:20:53 UTC)
 total_receives: 104
 total_received_bytes: 37771 (36.89 kB)
 total_transmitted_payloads: 7
 stream_buffer_maxlen: None
 process_ressource_usage: cpu=16.0%, memory=91.69 mB, threads=29
 ---------------------------------------------------------------------------------------------
               stream_id              |   stream_label  |  last  |  average  |  peak  | recon
 ---------------------------------------------------------------------------------------------
 12d9eeea-6b03-4bf0-9f0a-771f2c74b383 | kline_1m        |      3 |       2.8 |      5 |      0 
 16cb87f0-ab12-47f3-bcc9-533224959672 | kline_3m        |      3 |       2.8 |      5 |      0 
 1a7db9ae-b329-49fe-a3c7-f315b1c8b510 | kline_5m        |      3 |       2.8 |      5 |      0 
 5834fcb0-6bb5-45b3-9d29-2db467d01270 | kline_15m       |      3 |      2.62 |      4 |      0 
 b4e3eed5-66fc-48a2-9857-d364609779a1 | kline_30m       |      3 |       2.8 |      5 |      0 
 2a7873ae-8898-4fb0-9016-c995bfbf24ee | kline_1h        |      3 |      2.63 |      4 |      0 
 55fc04ee-9233-4d36-abe5-1f2527fa8e5a | ticker          |      2 |      1.75 |      3 |      0 
 7a21cc3a-d3ea-4990-abd9-611c9df9eac0 | userdata        |      0 |       0.0 |      0 |      0 
 ---------------------------------------------------------------------------------------------
 all_streams                                            |     20 |      18.2 |     31 |      0 
===============================================================================================


In [2]:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
oliver-zehentleitnercommented, Oct 13, 2021

Answer from Binance:

… the relevant issue was tracked down and fixed in the new build on the futures side, its currently in testing, and the production should be updated to it by the end of Oct.

And websockets lib has merged a commit for better compatibility: https://github.com/aaugustin/websockets/pull/1067

So if websockets release an upgrade or if binance future endpoints are upgraded we can turn on compression for future endpoint again.

1reaction
oliver-zehentleitnercommented, Sep 22, 2021

@June911 Sorry, I overlooked that this only concerns futures.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade to 1.34.0 (and websockets 10) sockets connect, but ...
1.34.0 does not receive data while using websockets 10. Downgrading to websockets 9.1 works fine. Attaching first 500 lines of debugs for ...
Read more >
Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >
Writing WebSocket servers - Web APIs | MDN
A WebSocket server can be written in any server-side programming language that is capable of Berkeley sockets, such as C(++), Python, PHP, or ......
Read more >
unicorn-binance-websocket-api - PyPI
An unofficial Python API to use the Binance Websocket API`s (com+testnet, ... Pick up the received data from the stream_buffer - if you...
Read more >
WebSocket connection failed: Error during ... - Stack Overflow
Socket.io uses a poll to connect initially then "upgrades" to more reliable transports (i.e. websockets). This answer forces socketio to only ...
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