Your logout code has problem. You are missing the value to pass in $getRecord(). I change the code into follow:
if (onlineUsers) {
var presenceId = UserFactory.getPresenceId();
console.log ("presenceId is " + presenceId);
var user = onlineUsers.$getRecord(presenceId);
console.log ("User is " + user);
onlineUsers.$remove(user);
}
And it remove the user from online user list. But we still have a BIG ISSUE: What if user session expire? It will kick the user out but it will not delete the online user.
I want to know how you use $onAuth to deal with session expire issue. Basically I want to figure out all the best practices to deal with user login, logout, and session management with Firebase and Ionic...
Your logout code has problem. You are missing the value to pass in $getRecord(). I change the code into follow: if (onlineUsers) { var presenceId = UserFactory.getPresenceId(); console.log ("presenceId is " + presenceId); var user = onlineUsers.$getRecord(presenceId); console.log ("User is " + user); onlineUsers.$remove(user); }
And it remove the user from online user list. But we still have a BIG ISSUE: What if user session expire? It will kick the user out but it will not delete the online user.
I want to know how you use $onAuth to deal with session expire issue. Basically I want to figure out all the best practices to deal with user login, logout, and session management with Firebase and Ionic...