Implement logout function

Allow the user to logout from his session, before a disconnection occurs.