Nala Ginrut <mulei@gnu.org> wrote:
> Jaft writes:
>
> >
Also, – not directly related but something I have been wondering in
regards to Artanis (if you don't mind me slipping in another quick
question here) – I know how to get spawn (and check for) a session.
> >
Is there any way to associate a user with a session? The manual offers a
pretty clear example of how to spawn a session on a successful login (
https://www.gnu.org/software/artanis/manual/manual.html#org59abe73) but it doesn't look that it stores the username, just generating the session ID.
> >
I was wondering if there was any way to store user data with the
session to know, for example, which user is currently logged into a
session?
> > Jonathan
> >
>
> Well, it's just a simple example, in product development, we have to do
> more that.
> If you want to trace the session id of a logged user, you may do it in
> several ways:
> 1. hash-table
> 2. DB
> 3. LPC (redis)
>
> Anyway, the principle is to create a lookup table to store <username, session-id>.
> Artanis doesn't provide a way for it, because there're considerations
> around performance and security. So we only provide the low-level mechanism.
Ah; that makes sense. I wasn't sure if Artanis offered a built-in mechanism, like Ruby on Rails; thanks for clarifying!
One thing I had been wondering, previously, is if there's any way to store global variables that every file would have access to? I remember (way back, though) I tried defining variables in the ENTRY file but found that my controllers weren't able to recognize that such a variable had been defined.
I'd figure that'd have use if, say, going the hash-table route and then being able to access that session data from any, say, controller.
Is there, also, any way to have Artanis run commands on every quit? I was looking at Guile Redis and it dawned on me that quiting Artanis would quit without closing the Redis connection; but, if you could set commands to run on quit, you could just have Artanis close the connection on every quit that way.
Nala Ginrut <mulei@gnu.org> wrote:
> Jaft writes:
>
> > Ahhh; I am using 3.0 for Guile. So perhaps that's where things are stemming from?
> >
I know I'm using the latest Artanis (heh, had to switch things when
using the latest release didn't work and we talked about it so I had
impetus to just pull directly from the latest commit with git).
> > Jonathan
>
> Oops! I found 3.0 had tweaked record type to unify all existing records,
> and it affected pattern matching, I'll ask Guile community for a
> confirmation.
Oh, I'm glad my inquiry turned-up/discovered something!
Jonathan