trails icon indicating copy to clipboard operation
trails copied to clipboard

Expose session into Trails app object

Open jaumard opened this issue 8 years ago • 4 comments

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 ?

jaumard avatar Feb 02 '16 13:02 jaumard

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)

jaumard avatar Feb 02 '16 17:02 jaumard

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.

tjwebb avatar Feb 02 '16 20:02 tjwebb

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 ^^

jaumard avatar Feb 03 '16 08:02 jaumard

Would it make sense for a trailpack-auth to require trailpack-sessions?

scott-wyatt avatar May 31 '16 22:05 scott-wyatt