Closed jerelmiller closed 1 year ago
Since this demo is for learning purposes, I opted to build our own subscription API that connects to the app's backend. The backend polls the playing state every second to see if there are updates and pushes changes to the client. While this doesn't allow us to register the app as a play target, I think it will be much better for learning purposes.
To really make the demo pop, it would be nice to show the currently playing track or podcast episode. This would include the play/pause button, shuffle, repeat, prev/next, and the progress bar.
We have 2 ways we can accomplish getting the playback state:
This is Spotify's official SDK for handling real-time playback state. This also registers a device that can be targeted by any Spotify player to play through the app itself. This would make for a nicer UX, but forgoes the change for us to show off the possibility of using Apollo Client for real-time UX using subscriptions.
Using our own API would be a great way to show off how to use a websocket connection and subscriptions with Apollo Client, with the expense of the nice UX built into the web playback SDK. This might also not allow us to register the app as a playback target. The API however has all we need to control playback, so this could be a great mechanism to demonstrate subscriptions.