Another question about session feature. ow do you ...
# ktor
v
Another question about session feature. ow do you do to don’t create a new session if the same user log again and again please ?
s
I think your users would prefer being able to use multiple devices concurrently
v
Yes but for example if the user log, shutdown his computer and try to go on the application, the feature session will create a new session instead of using the existing…
d
normally, it should be two different sessions logged with the same user per computer
and store persistent state somewhere else (not in the session) like a database
v
And there is no solution to clear the old session and create a new one ?
d
or you can manually store the sessionId in a database associated to the user, then when the user logs in, you set the cookie of the session with the right value
so both clients reuse the session for the same user
sessions are designed to be isolated, so you usually do not mess with other sessions
sessions usually expires with a TTL
v
But if all the user doesn’t logout, we will have a big number of session if no one clear the old session ?
d
if you know about a framework or langauge that does it differently and you can put a link so I can check, we can think about it
sessions usually are deleted based on a TTL
v
Ah ok And how can we configure this TTL ?
it depends on the storage
the directory based storage doesn’t implement TTL as far as I remember
but you can manually iterate the folder
and delete old sessions as a periodic task
👍 1
v
Hum ok Thanks