DaRealPheyeeD
Convex Community2y ago
10 replies
DaRealPheyee

Session Handling With Clerk

I am sure there is a solution for this but i don't know how to go about it.

I am not currently doing any session handling in my project but I need two use cases where I believe i need to work with sessions.

1. I want to be able to know the number of currently active/online users by finding out the users who currently have an active session.

Not sure if this is the right approach but i am open to ideas.


2. In clerk, i set a session lifetime to 5 minutes. If a user is currently on the site when the 5 minutes session lifetime counts down, the user is meant to be redirected to the login screen or the homepage but instead it throws an error.


I am not sure how i should go about these but the only thing i noticed so far is that Clerk has webhook event triggers for sessions when they are created, ended, revoked or timed out. But i don't know if this is the right approach because i also saw a Convex stack article on session tracking.

I will really appreciate the help.

Thanks in advance
Was this page helpful?