How to use mopidy - 2 common examples

To help you get started, we’ve selected a few mopidy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jaedb / Iris / src / js / services / mopidy / middleware.js View on Github external
return (store) => (next) => (action) => {
    switch (action.type) {
      case 'MOPIDY_CONNECT':
        if (socket != null) {
          socket.close();
        }

        store.dispatch({ type: 'MOPIDY_CONNECTING' });
        var state = store.getState();

        socket = new Mopidy({
          webSocketUrl: `ws${window.location.protocol === 'https:' ? 's' : ''}://${state.mopidy.host}:${state.mopidy.port}/mopidy/ws/`,
          callingConvention: 'by-position-or-by-name',
        });

        socket.on((type, data) => handleMessage(socket, store, type, data));
        break;

      case 'MOPIDY_CONNECTED':
        if (store.getState().ui.allow_reporting) {
          ReactGA.event({
            category: 'Mopidy',
            action: 'Connected',
            label: sha256(window.location.hostname),
          });
        }
        next(action);
github jaedb / Iris / src / js / services / MopidyService.js View on Github external
constructor( props ){
		super(props)

		this.connection = new Mopidy({
			webSocketUrl: "ws://music.james:6680/mopidy/ws",
			callingConvention: 'by-position-or-by-name'
		});

		this.connection.on( (type, data) => this.handleMessage( type, data ) );
	}

mopidy

Client lib for controlling a Mopidy music server over a WebSocket

Apache-2.0
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Popular mopidy functions