Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect disconnect event on a channel with Faye

I am trying to make a chat on my website looking like google talk. I want to manage the disconnect event. A user can disconnect on several way :

  • By clicking the disconnect button (easy to push the event to his friends)
  • By close his windows (I can send the event to windows close javascript event but if the user has many windows open on my website, i don't want to disconnect him.)

So, how can i detect when my connection on a channel is closed? Each user has his own channel build with his id.

Thank you for help.

like image 390
Sebastien Avatar asked Oct 28 '11 11:10

Sebastien


1 Answers

You can check out the meta events, /meta/unsubscribe and /meta/disconnect.

More info here: Faye Monitoring

like image 75
Heinrich Lee Yu Avatar answered Oct 14 '22 04:10

Heinrich Lee Yu