Hello everybody,
we are a group of german engineering students using a handful of RPis with Volumio to create a custom Multiroom Speaker Project.
We have been experimenting with writing our own Plugins based on existing ones. For example we have already written a plugin that reacts to gpio edges in a certain way (obviously based on the existing GPIO Control Plugin).
As of now we need the different Plugins (installed on the different RPis) to be able to communicate between one another to transmit their GPIO information. The idea was to use the npm package ‘socket.io-client’. While we are able to successfully send commands with socket.emit(…), we have tried a lot of different ways to create a function which is executed when a custom Websocket command is sent from another device.
To make it more clear, here is our code using the example given on the top of the Volumio-doc-page https://volumio.github.io/docs/API/WebSocket_APIs (this code does NOT work for us):
...
var io = require('socket.io-client');
var socket = io.connect('http://localhost:3000');
...
presenceRegistrator.prototype.onStart = function() {
var self = this;
socket.on('bringmepizza', function () {
self.logger.info("brought pizza");
});
};
...
So we have tried many different variations. Still, after activating the plugin and sending a Websocket command through a PC Programm called socket-io-tester.exe, nothing shows up on the volumio log.
I would like to add that the socket-io-tester works. For example by sending the command ‘volume’ and a number, the volume changes.
It may be noted, that the program is connected to ‘http://rasppiIP:3000’.
Also other logging around the ‘socket.on(…)’ command seems to work perfectly.
Any help is very much appreciated, as we have been looking for a solution for about two weeks now and there is very little on that matter to be found on google etc and the volumio doc is not very extensive on that topic.
Best regards!