[Seaside] How to get the number of user connected

Florian Minjat florian.minjat at emn.fr
Wed Dec 13 10:36:50 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

William Harford wrote:
> Florian,
> 
> (WASession allSubInstances select:[ :ea | ea isActive]) size
> 
> Will get you the total number of active sessions for all session. I 
> think something like ...
> 
> (WASession allSubInstances select:
>     [ :ea | ea isActive & (ea application name = "whatever" ) ]) size
> 
> Will get you what you want.
> 
> I have not tried the above but it should be close enough to get you 
> started.
> 
> Will
> 
> On Dec 12, 2006, at 10:31 AM, Florian Minjat wrote:
> 
>> Hi,
>>   I'd like to display on my seaside application the number of users 
>> currently connected to a particular application. I know I have to get 
>> some info from the sessions. But with a quick look into the code I 
>> could'nt manage to see how I could do that.
>>   Any hint ?
>>
>> Florian
>> _______________________________________________
>> Seaside mailing list
>> Seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 


More information about the Seaside mailing list