Search code examples
google-plusgoogle-hangouts

hangout API event on exit


I created a Hangout API that works to send invites to certain users from my server by sending an ajax request from my app with hangout url etc.

For now I need hangout event on exit so that I can make another callback to my server indicating that particular hangout has been closed.

I know it sounds odd. I looked around on https://developers.google.com/+/hangouts/api/gapi.hangout but didn't get any such events.

Can I tweak it in some other way to get a notification on exit?


Solution

  • I think this was already answered on the Google forums. The short answer is no there is currently not an event to detect the exit of the Hangout.

    You could have your app send a periodic heartbeat to your server and once you detect a timeout then you can conclude the hangout stopped.

    Another approach might be to implement an onbeforeunload handler within your hangout app and use that to send a Ajax call back to your server each time a participant leaves or just when the final participant leaves. You can get the participant count from the API and might also be able to use the participantChanged event. Not sure if participantChanged event will fire if the last user exits the hangout by closing the window, that could be a route to explore too.