Configuration
To configure the Spotify client functionality, the SpotifyClientConfig
class exists.
We won't cover every possible configuration in this part, head over to the specific guides for that:
- ...
#
HTTPClient NotesOne important part of the configuration is the used HTTPClient. By default, every time a SpotifyClientConfig
is instantiated, a new HTTPClient
is created in the background. For Web Applications that require a lot of different configs due to user based access tokens, it is not advised to create a new config from scratch with every HTTP call. Instead, a default (static) config should be used to create a new config with a new access token.
Consider the following HTTP Endpoint:
This creates a new HTTPClient
every time a request is made, which can be quite bad for the performance. Instead, we should use a base config and use WithToken
:
This way, a single HTTPClient
will be used. For a real example, checkout the ASP.NET Example.