Hi,
First of all, love the great job you've done putting this awesome piece of software on!
I'm currently trying to implement snap cast control into the existing Ionic-based app Mopidy-mobile in order to control both Mopidy and Snapcast server/clients.
But because I can't seem to find out how to easily create raw-TCP socket using Ionic, I think it might be easier to access Snapcast's API using Websocket or HTTP request ; but this isn't documented anywhere, and I can't find any more informations about it.
Does anyone have a solution / lead to solution for this issue ? I'd much appreciate it!
Regards, Quentin
Hi @qhello,
I'm working on a Electron app to control a Snapserver instance and I've got some code snippets which may interest you:
https://github.com/ThYpHo0n/Snapp/blob/master/src/services/SnapcastService.ts
https://github.com/ThYpHo0n/Snapp/blob/master/src/utils/telnetlib.ts
That should do it, I'll most probably do some further work in the upcoming weeks and implement all the missing commands like mute/change volume etc. into the SnapcastService. They are in Typescript but should be easily be ported back to JS if you like to or at least they give a pretty decent idea of how to implement raw tcp json rpc via Node sockets :)
@ThYpHo0n that's very useful stuff. I'm working on a similar challenge on Mopidy-Iris and have opted for an intermediary python service. It's ugly but it works. I'd much prefer a JS-based solution like yours.
The biggest hurdle I've encountered is figuring out how to have a (non-blocking) long-living TCP connection that monitors for notifications sent from Snapcast. Without which the web interface doesn't reflect changes made by other clients. Have you had any luck on this front?
HTTP requests are supported in recent versions
Most helpful comment
Hi @qhello,
I'm working on a Electron app to control a Snapserver instance and I've got some code snippets which may interest you:
https://github.com/ThYpHo0n/Snapp/blob/master/src/services/SnapcastService.ts
https://github.com/ThYpHo0n/Snapp/blob/master/src/utils/telnetlib.ts
That should do it, I'll most probably do some further work in the upcoming weeks and implement all the missing commands like mute/change volume etc. into the SnapcastService. They are in Typescript but should be easily be ported back to JS if you like to or at least they give a pretty decent idea of how to implement raw tcp json rpc via Node sockets :)