Cannot hook to events

Hi there,

I am trying to hook to some events but no success so far.
mopidy.on(console.log.bind(console)) expects 2 arguments ( The "listener" argument must be of type Function. Received type undefined at checkListener), so I cannot use it to list events. I tried:

mopidy.on("playback_state_changed", handler);

but nothing was received on playback start or stop. I don’t know if the event name is right, it should be prefixed with something (‘state:’, …), or how to find available valid event names. Can somebody help me?

Many thanks,

Here’s a generic statement that will catch all events: mopidyCli.on('event', console.log)
From there you can find events in console.

Thank you very much, @sapristi ! That was what I needed.

(I think it would be useful to update this in the documentation. I can volunteer if given some indication.)

Is this not already in the documentation at https://github.com/mopidy/mopidy.js/#hooking-up-to-events ?

Haha, I was looking at release-2.3 docs. Btw, I have mopidy version 2.2.3 installed on my Raspberry PI, as offered by the Raspbian 9 Stretch package.
Do you recommend installing v 3.0 ? (it seems I wouldn’t mind too much a development version.) Will it be possible on Stretch?

I do recommend Mopidy v3, we don’t support v2.x any more. But, Stretch is too old - see https://mopidy.com/blog/2019/12/27/mopidy-3-faq/#what-about-mopidy-3-on-debian-stretch