Skip to content
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

Track Sync Events #40

Open
8 tasks
IkeHunter opened this issue Sep 9, 2024 · 0 comments
Open
8 tasks

Track Sync Events #40

IkeHunter opened this issue Sep 9, 2024 · 0 comments
Labels
systems development Task involves integrating various microservices, and involves complex implementation techniques

Comments

@IkeHunter
Copy link
Collaborator

Intro

With the Spotify Web SDK and API, only polling can be used to get updates on current track - potentially sending too many requests to Spotify (and possibly getting charged more). Ideally we should directly communicate with Spotify as little as possible via the API/SDK, under the assumption that each request is charged (free under development mode).

The Web Player, however, uses a web socket connected to Spotify's servers in order to immediately receive updates to current track, allowing the player to react instantaneously to track changes. There are two problems with this:

  1. This is only allowed if the track is playing through the web player
  2. This is only offered client-side

In order to update the server with the song queue, and other updates regarding the current track, the client player will need to pass these updates to our server via the web socket and send (produce) those events to a Kafka topic to be consumed by the server.

Specs

Kafka topics:

  • current-track
    • key: groupId
    • actions: play, pause, next, previous

Flow

client (track change)
    ↓
Websocket message
    ↓
Websocket produces Kafka event
    ↓
Server consumes Kafka event
    ↓
Server handles track change event
    ↓
TBD...

Tasks

Create events between client and web socket:

  • Play track event
  • Pause track event
  • Next track event
  • Previous track event

Create server consumers:

  • Play track
  • Pause track
  • Next track
  • Previous track

The track queue or state doesn't need to be created, but everything should be in place to create and sync track state in the server.

@IkeHunter IkeHunter mentioned this issue Sep 20, 2024
3 tasks
@IkeHunter IkeHunter added the systems development Task involves integrating various microservices, and involves complex implementation techniques label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
systems development Task involves integrating various microservices, and involves complex implementation techniques
Projects
None yet
Development

No branches or pull requests

2 participants