Volumio Plug-in -

Hi,

I’m thinking of writing a plug-in for the volumio platform which is a multi room media streamer. The web socket server side is websocket.io and seems to have its own dependencies - “require socket.io” is typically found in the local scripts. Is is possible to use the web socket integration within THR?

The api is RESTful and found here :

https://volumio.github.io/docs/API/REST_API.html

John

You can’t use the “socket.io” library but you can use the Home Remote’s WebSocket library.

Thanks Bill.

I thought it would be possible. I assume its just a matter of making a connection and sending the packets in the expected format for the server end?

The expected data is pretty straighforward - expecting a message with additional data in JSON.
io.emit(‘message’,‘data’);

In the HR websocket I assume I would subsititue io.emit for socket.send (with the socket being the WS).

However im struggling to work out how to connect to the socket at the server side… socket.connect(“ip:port”) give me a unable to connect error?

Thanks

John

The connect method expects a URL that starts with the scheme. Kind of like how HTTP works. Usually it starts with “ws://” like in that example. Try “ws://ip:port”.

Yes sorry that’s what I tried like in the example and what i used in the kodi plug-in :

socket.connect(ws://ip:port);

John

I saw a post somewhere that said wedsocket.Io uses it’s own protocol and most web sockets won’t work. I have a plugin started using the REST api if you are interested. It’s still rough. I only have playback, mute and volume done, I’m not sure if I’m going to continue with Volumio so I haven’t thoroughly tested it yet. The main reason I was looking to use it was for the whole home audio function but they seem to be struggling with it (or maybe it’s me that is struggling).

Hi Matt,

I have been working on a REST plugin too, I have all the commands plus the gridviews working such as Tidal (spotify can be used too if you adjust) playlists, albums, radio a search feature etc. I was interested in the web socket jsut because there are more advanced features.

John