Cannot connect to Volumio using Python's socketIO client

Hey there,

I just updated Volumio to 3.703 (previously on 3.6xx) and it seems it’s broken my Python’s socket connection to Volumio on localhost (I use it to control Volumio using physical buttons and a fourteen-segment display).

Here is the kind of script that I used to run to initialize the socket connection:

from socketIO_client import SocketIO
socket = SocketIO('localhost', 3000)
socket.on('connect', self._on_connect)
socket.on('disconnect', self._on_disconnect)
socket.on('reconnect', self._on_reconnect)
socket.on('pushState', self._on_state_response)
socket.on('getState_response', self._on_state_response)
socket.on('pushQueue', self._on_queue_response)
socket.on('getQueue_response', self._on_queue_response)

Since I updated Volumio I’m getting this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/socketIO_client/__init__.py", line 353, in __init__
    resource, hurry_interval_in_seconds, **kw)
  File "/usr/local/lib/python3.7/dist-packages/socketIO_client/__init__.py", line 54, in __init__
    self._transport
  File "/usr/local/lib/python3.7/dist-packages/socketIO_client/__init__.py", line 62, in _transport
    self._engineIO_session = self._get_engineIO_session()
  File "/usr/local/lib/python3.7/dist-packages/socketIO_client/__init__.py", line 76, in _get_engineIO_session
    transport.recv_packet())
StopIteration

Would you have any idea how to fix it? Or is it possible to downgrade to the previous release?

Thank you for your help!

Hi all,

Just posting the solution to my issue: it turns out I wasn’t using the right Python package to connect to the socket with Volumio.

The solution was to replace it by the Python implementation of SocketIO, available at python-socketio · PyPI.

Volumio 3 currently uses socketIO server 2.3, so I had to target the version 4.x of the Python client.

Very little changes to my source code were needed for it to work, which was pretty unexpected.

Hopefully this can help someone else.