How to make emit when some variable changes?

I have a websockets server, in which i want to fire emit when there are n amount of users only ONCE. But for some reason it fires 2 times instead of 1. How would i get desired behavior?
1 Reply
erik.gh
erik.gh2y ago
why are you checking for usersCount to be > n shouldn’t you just usersCount === n? then you would only emit once the room has n members
Want results from more Discord servers?
Add your server