# Creating web clients that are backend-aware

**URL:** https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611
**Category:** Misc
**Created:** [March 9, 2015, 6:49pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611 "2015-03-09T18:49:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jcass77](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jcass77/32/721_2.png) [@jcass77](https://discourse.mopidy.com/u/jcass77)
#### Post date: [March 9, 2015, 6:49pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611/1 "2015-03-09T18:49:59Z")

</div>

Is it possible / a good idea to create web clients that are backend aware?

One example of why this may be useful is for web streaming services that contain additional features beyond just regular playback (e.g. the ability to rate songs in Pandora). If the web client knows which backend is being used, it could adapt the UI to accommodate the additional functionality by rendering additional buttons on screen.

Are there any examples of how this has been done, and is it something that the current API supports / encourages? I’m thinking that on a conceptual level this will involve interrogating the Mopidy registry for the list of installed backend extensions, adding the public methods to the extension’s PlaybackProvider, and then somehow exposing the new API in JavaScript to be used by the web client?

---

<div class="post-metadata">

### Author: ![adamcik](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/adamcik/32/5_2.png) [@adamcik](https://discourse.mopidy.com/u/adamcik)
#### Post date: [March 9, 2015, 7:50pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611/2 "2015-03-09T19:50:20Z")

</div>

This should be possible, if it’s a good idea I’m a bit unsure about. Similar things have come up before, having a love/favorite, ban and rate n-m type support.

Some relevant issues:

- [https://github.com/mopidy/mopidy/issues/495](https://github.com/mopidy/mopidy/issues/495)
- [https://github.com/mopidy/mopidy/issues/327](https://github.com/mopidy/mopidy/issues/327)
- [https://github.com/mopidy/mopidy/issues/263](https://github.com/mopidy/mopidy/issues/263)

Of these #263 is the one that best covers our currently vapor ware “metadata api” idea. Our thinking for this has been to have certain fixed metadata more or less corresponding what we have in the models today. And then supplement that with extension provided metadata. This could be data from things like lastfm or things like ratings/favorite/banned. But things haven’t taken enough form to get any where quite yet ☹

If we we’re to add support for this type of case I’m assuming supporting ratings from n to m, love and ban “actions” would be enough. We just need to see how to integrate it cleanly given our multitude of backends.

---

<div class="post-metadata">

### Author: ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)
#### Post date: [March 9, 2015, 9:33pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611/3 "2015-03-09T21:33:45Z")

</div>

For an example of a client implementing beyond what mopidy currently  
supports you can take a look at mopidy-mopify. It uses Spotify Web API  
calls to provide more functionality. It does this entirely outside of  
Mopidy and has to jump through a hoops in order to do so (with regard to  
authorisation and sharing state between clients) but works well. So even  
without support within Mopidy you can still do a lot.

---

<div class="post-metadata">

### Author: ![jcass77](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jcass77/32/721_2.png) [@jcass77](https://discourse.mopidy.com/u/jcass77)
#### Post date: [March 21, 2015, 3:47pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611/4 "2015-03-21T15:47:37Z")

</div>

Will the service framework being proposed at: [https://github.com/liamw9534/mopidy/pull/2](https://github.com/liamw9534/mopidy/pull/2) not also make this easier?

Either that, or a standard way of expanding the JSON RPC API for mopidy extensions.

---

<div class="post-metadata">

### Author: ![jcass77](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jcass77/32/721_2.png) [@jcass77](https://discourse.mopidy.com/u/jcass77)
#### Post date: [March 21, 2015, 3:50pm UTC](https://discourse.mopidy.com/t/creating-web-clients-that-are-backend-aware/611/5 "2015-03-21T15:50:18Z")

</div>

Looks like the implementation that you are referring to is based on this: [https://github.com/martijnboland/moped/blob/master/src/app/services/mopidyservice.js](https://github.com/martijnboland/moped/blob/master/src/app/services/mopidyservice.js)

It uses Angular which I am not familiar with and not currently being used in the Pi Musicbox web client. Are you aware of any _simple_ examples of how to make JSON RPC calls in Mopidy for anything not included in ‘core’?
