socketIO-client-2 icon indicating copy to clipboard operation
socketIO-client-2 copied to clipboard

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

Open alphara opened this issue 8 years ago • 11 comments

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})

alphara avatar Aug 10 '17 21:08 alphara

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.

feus4177 avatar Aug 11 '17 01:08 feus4177

Same issue here, newest protocol fails for this library.

matthax avatar Oct 04 '17 19:10 matthax

Looks like more people are interested

alphara avatar Oct 04 '17 19:10 alphara

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

bunver avatar Oct 05 '17 02:10 bunver

yes, please fix this

rudra32rajput avatar Nov 03 '17 11:11 rudra32rajput

+1 i'm also interested in support for v2

dijimsta avatar Jan 06 '18 15:01 dijimsta

+1 interested

dpanic avatar Jan 06 '18 21:01 dpanic

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

SohnyBohny avatar Jan 17 '18 14:01 SohnyBohny

@javajenks did some work on that

I have no clue whether this fixes any/all problems

SohnyBohny avatar Jan 18 '18 08:01 SohnyBohny

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/

alphara avatar Apr 27 '18 23:04 alphara

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

crossan007 avatar Feb 19 '23 18:02 crossan007