Mopidy has a WebSocket endpoint at /mopidy/ws. You can use this end point to access Mopidy's full API, and to get notified about events happening in Mopidy more info.
Mopidy has a WebSocket endpoint at /mopidy/rpc. You can use this end point to access Mopidy's full API. However you cant listen to events via this endpoint more info.
You can use JS library shipped with mopidy to access full Mopidy api. For more info visit mopidy.js docs. However examples on this page initiate connection using following scrip:
var mopidy = new Mopidy({ webSocketUrl: "ws://localhost:6680/mopidy/ws/", callingConvention: "by-position-or-by-name" });
{{getCurl(class+'.'+method)}}
{{getJS(class+'.'+method)}}
Here you can see events arriving from Mopidy in real time:
Nothing to see? Try playing a track using your MPD client.
For more information, please refer to the Mopidy documentation at docs.mopidy.com.