Action on all clients after updating the collection


I’m trying to understand MeteorJS and do not understand how can I execute code on all clients after the collection has changed.

In my case, the change of status should start working JS client library in all clients and play the song. If you run this client library in the file collection (where the collection is updated), it will apply only to the user who clicked to play. I was able to solve this problem only tracking changes to the HTML, but I’m sure there’s a more correct solution.

My pseudo code:


	{"_id": id},
	{$set: {"status": "play"}}


PS And sorry for my bad English.


How do you subscribe to your data? Collection cursors are reactive so a template would update on all clients that have subscribed to the same data.