A Rust-based Spotify Connect device server that allows creating and managing multiple virtual Spotify Connect devices. Originally designed to enable Minecraft players to create personal Spotify Connect devices within the game.
- Create multiple virtual Spotify Connect devices
- Each device has a unique ID and custom name
- Control playback for each device independently
- Real-time bidirectional communication via WebSocket
- Automatic device ID generation
- Clean connection handling and resource management
- Python test client included
- Rust (latest stable version)
- Python 3.6+ (for test client)
- Spotify Premium account
- Spotify API access token
- Python websockets library (
pip install websockets)
cargo build --release- Start the server:
cargo run --release- Run the test client:
python test_client.pyThe server operates on WebSocket protocol (port 8888). When a client connects to ws://localhost:8888/ws, a connection is created where the client can execute commands like CreateDevice to start using the Spotify Connect device or commands like Load to start interacting with an specific device.
- Client connects to
ws://localhost:8888/ws - Server responds with a success or error message. In case of success, providing the protocol version.
{
"status": "Connected to server",
"protocol_version": "1.0.0"
}- Now the client can start executing commands.
- CreateDevice: Initialize a Spotify Connect device with an access token
All commands follow this JSON structure:
{
"command_type": "Name",
"params": {
"key": "value"
}
}For example:
{
"command_type": "CreateDevice",
"params": {
"device_name": "Blockify Boombox #2",
"token": "yQRB....MEg3"
}
}All server responses to commands follow this format:
{
"success": true/false,
"message": "Response message",
"data": {} // Optional additional data
}MIT License
Contributions are welcome! Please feel free to submit a Pull Request.