[Seaside] How to get the number of user connected
Ramon Leon
ramon.leon at allresnet.com
Wed Dec 13 16:01:27 UTC 2006
> Thanks again for your answer.
> It works fine and answer me the number of active sessions for
> a given application.
> The problem is that I'd like to count the active users logged
> in. And there could be several sessions by user. So I'll need
> to get to the WAComponent of my application and test the name
> of the user.
> I just manage to do that quickly with the session like this :
>
> self state objects keysDo: [:k | (k class == MyComponent)
> ifTrue: [^ k user]]
>
> But this is ugly because I needed to define WASession>>state and
> WAStateRegistry>>object to access the state. Is there any 'clean' way
> to get to the application state from its session ?
>
> Florian Minjat
If you already know what your component is, just access it directly
MyComponent allInstances, or even, MyUser allInstances, and count them
directly, no need to go through the session.
Ramon Leon
http://onsmalltalk.com
More information about the Seaside
mailing list