Skip to content

Comments

Add websockets server to librespot#152

Closed
sashahilton00 wants to merge 2 commits intoplietar:masterfrom
sashahilton00:websockets
Closed

Add websockets server to librespot#152
sashahilton00 wants to merge 2 commits intoplietar:masterfrom
sashahilton00:websockets

Conversation

@sashahilton00
Copy link
Contributor

Adds web socket server. Badly coded, intended as PoC. Aka. Can't Recommend A Pull (request). Also updates spotify_id.rs with new methods.

It would be good to have something like a websockets server that makes it easy for users who do not have a good grasp of rust (me)/want to integrate with librespot in a relatively easy/quick manner for whatever project they are working on. Hence this PR includes some barebones functionality that allows one to get the current activity of librespot via a websockets server running on port 3012. It would be good if someone who has a clue what they are doing could look at and rewrite it so that librespot is not hosting a websocket server in one part of the application, then starting a client in another part just to send out the messages. From there it would be possible to add things such as client side queries, proper metadata, play queues, etc.

Like I said, this code is rubbish, and should be left in a separate branch to master. As it currently stands there are a number of issues not limited to:

  1. Client has to wait for next song to load before being able to see what song is playing
  2. Client cannot query librespot, only listen to server events.
  3. There is no control over what the websocket server sends out in any way. It would be perfectly possible for someone on your network to send JSON messages to the server to make all connected clients think Rick Astley was the only artist playing, etc. You get the idea.
  4. Rubbish code, both in terms of design and implementation. Still, beggars can't be choosers.

S.

sashahilton00 and others added 2 commits February 6, 2017 16:01
Adds web socket server. Badly coded, intended as PoC. Also updates
spotify_id.rs with new methods.
@sashahilton00
Copy link
Contributor Author

@plietar was just thinking back to what you mentioned in the other pull request, presumably one could use websockets for the ipc that you mentioned in the other pull request?

@plietar
Copy link
Owner

plietar commented Feb 9, 2017

Not sure what PR you're referring to ? The volume control #148 ?
Then not really, librespot would be making the volume change requests to the mixer program, not the other way round.

Overall I think this functionality should live outside librespot. Spotifyd maybe ? I'd be happy to add infrastructure to pull the events out of librespot if needed, but the websockets API doesn't belong in here.

@plietar plietar closed this Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants