not working

Hi there,

For a DIY project I try to get the player state via websocket in node.js. In another project on another RPi it works very nicely with python but since I want to make a plugin in the end, I moved to JS.
For development I use a spare RPi 2 Model B, which runs with Volumio 2.861.
I seem not to be able to receive any message. I created a very basic test-script based on the information in this post.
Below is my script (exact copy). But it does not log any message (also not when replacing localhost with the IP of one of my other Volumio systems). I followed the debugging instructions on webpage, but the log (posted below) does not give me an idea.
“parser error” and a subsequent “transport error” do not ring a bell.
I use 3.1.1
Any suggestions? Also tried to run the script on my Mac connecting to the Volumio-systems, but same silence…

Regards, Thomas

My simple test-script:

var io = require('');
var socket = io.connect('http://localhost:3000');

socket.emit('getState', '');
socket.on('pushState', function(data) { 
} );

When I run

DEBUG=* node test/test_ws.js 

I receive the following debug log (which is repeating): parse http://localhost:3000 +0ms new io instance for http://localhost:3000 +0ms readyState closed +0ms opening http://localhost:3000 +1ms creating transport "polling" +0ms options: {"path":"/","agent":false,"withCredentials":false,"upgrade":true,"jsonp":true,"timestampParam":"t","rememberUpgrade":false,"rejectUnauthorized":true,"perMessageDeflate":{"threshold":1024},"transportOptions":{},"hostname":"localhost","secure":false,"port":"3000","query":{"EIO":4,"transport":"polling"},"socket":{"secure":false,"hostname":"localhost","port":"3000","transports":["polling","websocket"],"readyState":"opening","writeBuffer":[],"prevBufferLen":0,"opts":{"path":"/","agent":false,"withCredentials":false,"upgrade":true,"jsonp":true,"timestampParam":"t","rememberUpgrade":false,"rejectUnauthorized":true,"perMessageDeflate":{"threshold":1024},"transportOptions":{},"hostname":"localhost","secure":false,"port":"3000"},"id":null,"upgrades":null,"pingInterval":null,"pingTimeout":null,"pingTimeoutTimer":null}} +2ms polling +0ms xhr poll +0ms xhr open GET: http://localhost:3000/ +7ms xhr data null +4ms setting transport polling +75ms connect attempt will timeout after 20000 +86ms readyState opening +7ms polling got data 97:0{"sid":"kwLSd1ZtAuYwAHU6AAAY","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000} +153ms socket receive: type "error", data "parser error" +89ms socket error {"code":"parser error"} +2ms error +83ms cleanup +2ms will wait 582ms before reconnect attempt +8ms socket close with reason: "transport error" +17ms transport not open - deferring close +27ms attempting reconnect +588ms readyState closed +1ms opening http://localhost:3000 +0ms

Figured out a solution in the meantime: I noted, that my working Python script was using an older version of
So I downgraded the npm module to 2.4.0 and it works now.
So it looks like the 3.1.1 cannot parse the Volumio messages anymore or it needs to be called differently (although I do not get any errors). Do not have enough time right now, to dig into details. Will do so later and post an update.
Fix for the time being:

npm install



3.x.y is a semver major update – i.e a breaking change. So it’s not backwards compatibly with the old 2.x version running on Volumio.

PS: Posting in Volumio Development - Volumio topic would get you eyeballs from people working on the code :wink:

…absolutely right…
Sorry, have a full time job and family and limited time to make this, so I rather try to just build it pragmatically, than first become a professional Java programmer :wink:
I misinterpreted the carret-range syntax “^2 .x.x” as “higher than”, while it just means a higher minor revision or patch.
Typical newbie mistake - apologies.

Oh, don’t worry, I had a similar head scratching time recently, so wanted to save you the investigation :wink: