mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #376] [CLOSED] Introduce a web socket server for faster communications and ability to re-authenticate. #894
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#894
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/376
Author: @yyjhao
Created: 9/28/2019
Status: ❌ Closed
Base:
dev← Head:add-ws-server📝 Commits (2)
ba7b27fwipc5e75cdRemove accidentally added file.📊 Changes
7 files changed (+341 additions, -7 deletions)
View changed files
📝
Cargo.lock(+66 -0)📝
Cargo.toml(+2 -0)📝
connect/src/spirc.rs(+12 -0)📝
src/main.rs(+50 -6)📝
src/player_event_handler.rs(+1 -1)➕
src/player_ws_server.rs(+90 -0)➕
src/ws_server.rs(+120 -0)📄 Description
This introduces a web socket server so to allow sending player events more efficiently. It also supports a "reauth" event to allow the player to reauthenticate again (if username/password is provided in the command line interface).
The purpose of this is to make it easier to build smart player interfaces around librespot. In particular, "reauth" is useful in dealing with the occasional connection dropping issue making the player not appearing in the sportily web API player list unless the user actively connect to it through an official spotify app in the same network again.
To use this, add
--ws-port <port_number>to the command, this will start a web socket server listening at<port_number>. Then, with any web socket client can connect to this port. Once connected, the client will receive messages when the player state is updated like so:The client can also send the following message to the server:
If
--ws-port <port_number>is not provided it will not spawn any web socket server.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.