How can I logout the user when all windows opened with the app closes? The following code only logouts the user when one of the browser window is closed. If the user has multiple windows with the app opened, it will logout all windows using the same user.
You could use a package like tmeasday:presence to detect how many sessions the user has, and when it is down to one, you can activate the onbeforeunload
@serkandurusoy Thanks for your response. I am using the mizzao:user-status package. How can I detect how many sessions the user has? Should I count how much documents there are in the ipAddr field in the UserStatus.connections for a user?