feus4177 / socketIO-client-2

A socket.io client library for Python
http://pypi.python.org/pypi/socketIO-client-2
MIT License
16 stars 15 forks source link

Is socketIO-client-2 v0.7.5 compatible with socket.io v2.0.3 #10

Open alphara opened 7 years ago

alphara commented 7 years ago

I'm using socketIO-client-2 v0.7.5 and socket.io v2.0.3. On my machine, those versions doesn't work together.

Are those versions compatible?

socketIO-client-2 v0.7.5 is working good with old version socket.io v1.4.8.

I found that modules are supporting different versions of protocols.

Please note that this version implements socket.io protocol 1.x https://pypi.python.org/pypi/socketIO-client-2/0.7.5

Current protocol revision: 4 https://github.com/socketio/socket.io-protocol

I'm getting the following stack trace with latest versions:

Traceback (most recent call last):
  File "/Users/artemarakcheev/anaconda/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Users/artemarakcheev/anaconda/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "loadTest.py", line 140, in rtWorker
    socketIO = setupStream(asrUrl, clientKey, clientSecret)
  File "loadTest.py", line 130, in setupStream
    headers={'Authorization': 'Bearer ' + bearerToken})
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/__init__.py", line 345, in __init__
    resource, hurry_interval_in_seconds, **kw)
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/__init__.py", line 58, in __init__
    self._transport
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/__init__.py", line 66, in _transport
    self._engineIO_session = self._get_engineIO_session()
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/__init__.py", line 80, in _get_engineIO_session
    transport.recv_packet())
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/transports.py", line 92, in recv_packet
    for engineIO_packet in decode_engineIO_content(response.content):
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/parsers.py", line 95, in decode_engineIO_content
    content, content_index)
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/parsers.py", line 202, in _read_packet_length
    while get_byte(content, content_index) not in [0, 1]:
  File "/Users/artemarakcheev/anaconda/lib/python3.6/site-packages/socketIO_client/symmetries.py", line 36, in get_byte
    return six.indexbytes(x, index)
IndexError: index out of range

This is snippet with connection thru socketIO-client-2

from socketIO_client import SocketIO
...
        socketIO = SocketIO(
            asrUrl,
            verify=False,
            transports=['websocket'],
            headers={'Authorization': 'Bearer ' + bearerToken})
feus4177 commented 7 years ago

Like you pointed out, socketIO-client-2 was written for the 1.x version of socket.io. Looking at the release notes for v2 of socket.io it sounds like there were some significant changes so I wouldn't be surprised if it isn't compatible with socketIO-client-2. If more people are interested in supporting v2 I could look into supporting it. If not, feel free to open a pull request.

matthax commented 6 years ago

Same issue here, newest protocol fails for this library.

alphara commented 6 years ago

Looks like more people are interested

bunver commented 6 years ago

I'm also interested and couldn't find any client library for python to communicate socket.io server side

rudra32rajput commented 6 years ago

yes, please fix this

dijimsta commented 6 years ago

+1 i'm also interested in support for v2

dpanic commented 6 years ago

+1 interested

SohnyBohny commented 6 years ago

I'm also interested :+1: @feus4177 please look into it :smile:

SohnyBohny commented 6 years ago

@javajenks did some work on that

I have no clue whether this fixes any/all problems

alphara commented 6 years ago

This is a forked version of 'socketIO-client' to implement the Socket.io 2.x changes. https://pypi.org/project/socketIO-client-nexus/0.7.6/

crossan007 commented 1 year ago

Is there still no Python version of a Socket IO client that supports server version 2?