pushState delayed when changing album

Hello, this is not really a bug but it’s a little annoying…I use Websockets API to update a remote display with play infos, sending ‘getstate’ request every 500ms.
In response I get pushState with Json-encoded infos. (I noticed that volumio sends pushState autonomously when user changes something on web panel.)
Problem is, when I change album/artist pushState answers stop for 8-10 seconds, so my display freezes as well.
After this time I get 8 updates all at the same time.
Is it possible to avoid this ?

Just don’t request getState after 500ms, you are clogging everything…
Just listen to pushState and you’ll be fine

Hello Michelangelo (ciao)
I cannot, I need to periodically ask Volumio’s state in order to update my progress bar…
Anyway, I tried to stop my request and to just wait for spontaneous updates…Behaviour is the same, update arrives 8-10 seconds after alum change…

There must be something wrong with your implementation then.
What are you using? Are you using socket.io?

An alternative would be using the REST API:
volumio.github.io/docs/API/REST_API.html

I am using SocketIO (python), my program is derived from volumio-buddy. I use a class named VoulmioClient

class VolumioClient:

def init(self):

self._client = SocketIO(HOSTNAME, PORT, LoggingNamespace)
self._client.on(‘pushState’, self._on_pushState)

Periodically i emit
self._client.emit(‘getState’)

my callback updates my internal state and sends it via serial to my display
def _on_pushState(self, *args):

please notice that normally I get always correct answer to my 500ms polling, I notices these clogs only when I change artis/album

Maybe it’s your parsing strategy then?

I tried just to print a simple message upon callback:
def _on_pushState(self, *args):
print “_on_pushState”

and not to ever poll Volumio. When I change album, I get nothing for 8 seconds and then 8 callback all together. mmmmhhh…perhaps something related to socket.IO ? Could be something like a queue slowdown inside Volumio WebSocket mechanism ? (my program runs on same raspberry Volumio runs on)

UPDATE: there was a problem with my json parser, now update in case of album change is fast. Thank you for your patience