Problems adding webradio via WebSocket API


I’m trying to add a web stream to the queue and play it using the “addPlay” websocket command.
The reason behind is that I want to control volumio with my Logitech Harmony remote, where I have several buttons for different web radio stations.
So I want it to append the radio station to the queue and play it.

I’m having trouble getting it to work in python. It seems like it is not even reaching the server:

payload = json.dumps({"uri": "", "title": "FM4"}, ensure_ascii = False).encode('utf8') with SocketIO(HOST_NAME_VOLUMIO, 3000, LoggingNamespace) as socketIO: socketIO.emit('addPlay', payload)
I’m using the socketIO-client from here:
I assume that it either has something to do with the JSON parameter or the fact that the "with … " part kills the connection too early. Since I’m not interested in a response I don’t need to listen to state changes.

From NodeJS something similar works:

var io=require(''); var socket= io.connect('HOST_NAME_VOLUMIO:3000'); socket.emit('addPlay', {'service':'webradio','title':'FM4','uri':''});
Anyone have an idea?


Sorry Jochen, but I don’t know anything about python and combined… Any pythonista around?

Hey michelangelo,

finally it worked.

There is kind of a mess of possible socketIO clients because there are several with the same name. So, I used the one mentioned above in version 0.7.0 (latest).

sudo pip install -U socketIO-client
With this:

from socketIO_client import SocketIO, LoggingNamespace
command = “addPlay”
argument = {‘service’:‘webradio’,‘title’:webradioname,‘uri’:webradioUri}

with SocketIO(HOST_NAME_VOLUMIO, 3000, LoggingNamespace) as socketIO:
socketIO.emit(command, argument)[/code]

you can append a webradio track and play it (with some caveats).

Note that argument is not a JSON string but directly a JSON structure. Yes, apparently that’s a thing in python.

The caveats are that there are some bugs surrounding the queue management which leaves the UI at inconsistent state or does not react if the same stream is readded to restart it. I will create some bug reports for that.


I don’t see the “addPlay” command in although I have it working in a python code snippet for my own interest. What doco am I missing?

Now I’ve logged a ‘pushToastMessage’. That reply doesn’t seem to be documented anywhere either?