Rayman / fusic-meteor

Fusic: Realtime Social Music Collaboration
MIT License
27 stars 12 forks source link

Users playing a song isn't representative #48

Open pepf opened 10 years ago

pepf commented 10 years ago

It never deletes user's of the list. We should make use of some sort of polling to make sure user is actually still playing the list or logged in, otherwise remove the user.

Something like https://github.com/murilopolese/howmanypeoplearelooking could be a good starting point

reinzor commented 10 years ago

Just log a time stamp . No polling On Jun 29, 2014 5:13 PM, "Pepijn" notifications@github.com wrote:

It never deletes user's of the list. We should make use of some sort of polling to make sure user is actually still playing the list or logged in, otherwise remove the user.

Something like https://github.com/murilopolese/howmanypeoplearelooking could be a good starting point

— Reply to this email directly or view it on GitHub https://github.com/Rayman/fusic-meteor/issues/48.

pepf commented 10 years ago

Sorry, I didn't mean polling; the "howmanypeoplearelooking" solution is about monitoring the "socket close" event from somewhere deep inside the core of Meteor and then mapping it to one of the userIds. I think that's pretty clever, when you're disconnected obviously you can't be playing any songs.

So this part:

 socket.on('close', Meteor.bindEnvironment(function () {
            People.remove({
                connectionID: socket.id
            });

is where they basically remove a user from a collection based on the socket.id.