Monday.listen("events", callback) problem

Got a problem based on that part of the documentation monday.listen

I try to get information about changes I make via openItemCard and get no response, no console.log. Can someone show me working sample how to use that listener?

Hello there @mpsujek,

Could you please share the full monday.listen action you are using and what changes you are performing that are not being “listened to”?

I’m trying to get any response from monday.listen(“events”,…
I did it like this

  useEffect(() => {
    const callback = (res) => console.log(res);
    const unsubscribe = monday.listen("events", callback);
  }, []);

I got that working but now I’m not sure what I’m doing wrong.

Ok more information about that, I have that listener

useEffect(() => {
    const callback = (res) => console.log(res);
    const unsubscribe = monday.listen("events", callback);
    return () => unsubscribe();
  }, []);

And when I’m on development setup that doesn’t work. Seems there is some issue with the tunnel or with running the app build in that view.
But when I install the app on my board I’ts works as it should.

Hello again @mpsujek,

Are you referring to the “preview” section in your app’s feature configuration page?

If so, have you added boards to be connected to the view?

Yes I’ve added that to board but its not easy to debugging my app In that way.

Hello again,

For monday.listen to work, you need to run it with a context present.

That is why you would need for the view to be “connected” to a board.

If I understand correctly, this does work when you use it in an actual board. Correct?

In that case, that is the way you have to test this.

Let me know if you have any questions!

Cheers,
Matias