Using Websocket to control playback - for dummies.

Hi all,

First of all, I’m a coding and linux newbie, so forgive me for what I’m about to ask you.

I’m using Volumio on a RPi to play webradio in my living room. Most of the time I listen to the same stream, but I occasionally need to change stream, stop play back and change volume.

Since I don’t need most of the controls and features of the Volumio web interface, I’ve been looking into controlling playback and volume with REST API, but I was wondering if you guys have a tip for best (or better) practice.

At the moment all REST API calls are done via a HTML page, uploaded on an remote webserver, like this:

<iframe style="display: none;" height="64px" width="64px" src="" name="iframe_a"></iframe>

<a href="http://volumio.local/api/v1/commands/?cmd=play&N=3" target="iframe_a">
<img src="DRP4.png" width=64></a>

This is code-wise really ugly, but that’s where my skills are at. And it works well - the delay is close to unnoticeable. But my phone isn’t happy about the IFRAME, and I reckon that Websocket IO overall would be a more elegant solution.

I’ve read the docs at but I need a more thorough and basic explanation - I’m at basic html-level.

How would I go about making a HTML page using Websocket to control playback? Or am I better off taking another approach?

Thanks in advance for any input.