trails
trails copied to clipboard
Expose session into Trails app object
It would be nice if we can access to the http session from Trailpack (or trails services).
Maybe like : app.session
like this we can access the session whatever the chosen web server.
What do you think ?
I can explain why I need sessions :) I'm working on a trailpack-analytics https://github.com/jaumard/trailpack-analytics that will allow to track REST API from Trails (by just given the google account id). But in order to do it I need a way to define a unique user and send "page" or "event" to analytics. That's why I need to access the session (whatever the chosen web server)
Maybe like : app.session like this we can access the session whatever the chosen web server.
I think we'll need to wait for trailpack-auth to be built first. session management depends not only on webserver, but deployment infrastructure. e.g. for horizontally-scalable systems, the sessions will need to be hosted in a shared cache (e.g. redis) which means they can't be available on some global variable in the way you describe.
Ho I understand, I didn't think about the horizontally-scalable systems
but maybe we can think to another way to make session available to Trailpacks too. I just test my trailpack-analytics
and it works ^^ the only missing thing is a way to detect single user.
Another thing I'm thinking is, why trailpack-auth for session ? Maybe user need sessions but don't need authentifications. For me it's 2 separate things. Cause if I want to set up analytics on a public web site I don't need auth at all.
Maybe a trailpack-session need to be create (and use by trailpack-auth). trailpack-analytics
will wait a little ^^
Would it make sense for a trailpack-auth to require trailpack-sessions?