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