Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Snapcast integration issue #23

#1

I have a brand-new install of RompR, following the directions exactly. It's running on the same VM that also runs my Mopidy and Snapcast servers. Most things seem OK, except that there's an issue with the Snapcast integration.

When I enter the correct values in the configuration panel--either localhost or 127.0.0.1, port 1705--I get simply "[object Object]" under the Snapcast header, and that's it. (If I enter incorrect values, I get "Could not connect to snapcast server".) I don't know enough PHP or JS to figure out why this is happening.

This is running on Debian, with pretty much everything up to date. PHP 7.3. I can give more system details if it would help.... Thanks.

  • replies 5
  • views 4K
  • likes 0
#2

Strange. I can't see how that's happening. I'm running Raspbian, which is basically the same as you.

Can you enabled debug logging (https://fatg3erman.github.io/RompR/Troubleshooting#debug-logging) at Level 9, then refresh the page and attach the log. There should be some entries in it starting with SNAPCAST - those are the ones I need to see.

Also tell me what version of snapcast you're running.

Thanks.

#3

Thanks very much. I did this, and then went back into the Snapcast section of the panel and hit space (leading to a 'Can't connect" error) and then backspaced it out (returning to the [object Object] message). The results:

# grep SNAP /tmp/snapcast-debug 
20:01:27 : TRACE : SNAPCAST          Connecting to localhost:1705
20:01:27 : TRACE : SNAPCAST          Sending  {"method":"Server.GetStatus","id":5,"jsonrpc":"2.0"}
20:01:27 : DEBUG : SNAPCAST          Output is {"error":{"code":-32700,"data":"[json.exception.parse_error.101] parse error at 53: syntax error - unexpected '}'; expected end of input","message":"Parse error"},"id":null,"jsonrpc":"2.0"}
20:01:35 : TRACE : SNAPCAST          Connecting to localhost:1705
20:01:35 : TRACE : SNAPCAST          Sending  {"method":"Server.GetStatus","id":5,"jsonrpc":"2.0"}
20:01:35 : DEBUG : SNAPCAST          Output is {"error":{"code":-32700,"data":"[json.exception.parse_error.101] parse error at 53: syntax error - unexpected '}'; expected end of input","message":"Parse error"},"id":null,"jsonrpc":"2.0"}
20:01:41 : TRACE : SNAPCAST          Connecting to localhost :1705
20:01:41 : WARN  : SNAPCAST          Snapcast connection failed
20:01:41 : DEBUG : SNAPCAST          Output is {"error":"Could not connect to snapcast server"}
20:01:42 : TRACE : SNAPCAST          Connecting to localhost:1705
20:01:42 : TRACE : SNAPCAST          Sending  {"method":"Server.GetStatus","id":7,"jsonrpc":"2.0"}
20:01:42 : DEBUG : SNAPCAST          Output is {"error":{"code":-32700,"data":"[json.exception.parse_error.101] parse error at 53: syntax error - unexpected '}'; expected end of input","message":"Parse error"},"id":null,"jsonrpc":"2.0"}

As for the Snapcast version:

# snapserver --version
snapserver v0.17.1
Copyright (C) 2014-2019 BadAix (snapcast@badaix.de).
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Johannes Pohl.

Hope this helps. Thanks for your quick attention!

#4

Thanks that's helpful.

[object Object] is because I'm not decoding that error message correctly. The error message is sligtly mysterious but there always was a bit of a weird thing I had to do in the snapcast connection code. You're running a newer version than me which explains why the thing I did isn't working. I suspect the fix is quite simple but it's going to be a while before I can do another release... but.

If you're happy to try editing a file, find the file rompr/snapcast/snapapi.php

Find lines 50 and 51 which currently say

//For some reason, fputs strips the final } off the string
fputs($this->connection, $json."}\n", strlen($json)+2);

and change that to

fputs($this->connection, $json."\r\n");

which is both more correct and ought to work. Let me know how it goes.

#5

Thank you! That did indeed solve it.

Onwards! Thanks for the terrific project.

#6

Good stuff! Thanks for letting me know.

(Don't forget to disable Debug Logging now we've tracked it down)