-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] JSON RPC API #109
Comments
Open a TCP connection on port 1705. Send and receive messages formatted according to JSON RPC spec. You can see an implemention in Python here. |
Thank you for your answer. But I can't install the Python package on my box. |
You should be able to use |
Your Message Looks good but I don't have a clue whether it can work via post. But from what happyleavesaoc said, I would try binary instead of raw |
OK finally it works with JSON api, I've added "\r\n" at the end of my request. Other question : Is there a JSON method for connecting or disconnecting a specified client? |
Yep, the snapserver expects "Newline Delimited JSON" (ndjson). Not wrapped into HTTP, but pure ascii json over TCP. The newline There is a "spec" (work in progress) here: You can find a java implementation in the Android client's source code. There is no method to connect or disconnect a client. You can mute/unmute a client, but you cannot disconnect a client. BTW: thanks for the hint about POSTman 👍 |
This is what I do, I mute the client where I don't want to listen music, but I suppose the stream is still sent to the client. |
true, but the "control connection" must be there to be able to reconnect. |
closing, as it is related to #150 |
hi, same issue here: should be possible to post an example of the json message to use ? i tried several time with no luck... i would like to use a curl command. |
There are examples here. |
thanks for quick reply: something like that should be ok ? 'cause doesn't work curl --data-binary '{"id":8,"jsonrpc":"2.0","method":"Server.GetRPCVersion"}\n' 127.0.0.1:1705 |
curl will still use HTTP, when I get it right: |
Hi, If u are interested I developed a python deamon that listens and bridges http request to raw socket.I can share it pushing on github if u want. regards |
Yes, why not 😃 I will reopen this issue. Just to collect some more ideas, as my knowledge of what kind of "webservice" is most convenient is rather limited. |
Perfect , I'll clean the code and I'll push on github. I you like it i'll do a pull request. I'll write you an email when ready. |
https://github.com/freedreamer82/snapcastHttpd try it with : let me know if it works from your side. Marco |
curl didn't work for me. i managed to get an answer from the snapcast server with that command: the space after GetRPCVersion"} and ' is very important. without it I got an error. it took me long time to find this hack... |
@badaix to answer your question of how convenient Websockets are for clients, the answer (in my opinion) is: very! Connecting via TCP is generally limited to server-side clients, whereas Websockets are client-ready as well a server-ready. In my experience Websockets are much more widely supported than TCP. This is supported by the number of people asking for help connecting to the Snapcast API from their applications. I believe the request for Websocket functionality is already opened: #250. Do you think this is something that you'll be looking to implement? |
HTTP Put and Websockets are meanwhile implemented and accessible via port 1780 |
Hi,
I don't really understand how to remotely get, or set the status or volume of a client thanks to JSON RPC API.
The port seems to be 1705.
May I achieve this with a HTTP request?
My aim is to integrate Snapcast to the Fibaro Home Center 2 (a smart box)
Sorry for my stupid question...
The text was updated successfully, but these errors were encountered: