It could be event-based, not timer based.

For example, if the server gets NO REQUESTS at all, then it may never test the state of existing sessions. Why should it?
If a tree falls in the forest...

But when it does eventually get a request from someone, that's when it will take a look at ALL sessions - and fire onSessionEnd against the expired ones.

Just another amateur guess. But in that case, it seems like it would still fit your needs - unless you want to be actively notified the second a user's expired.

Al

On 3/2/2013 4:09 PM, Marcus F wrote:
I've gotten onsessionend to run a few times, but it's incredibly unreliable and doesn't run all the time.

What I'm thinking of doing instead is to have the message hash function (The user only loads the messages if there are new messages to load, based on a hash of the message log, clients call it every 3 seconds) to also save the timestamp of the last call. Then have a scheduled function go through the list every few minutes and look for old timestamps and remove their names from the userlist.

Somehow it feels like a hack solution, but with my current issues with sessions I'm going to give it a whirl later on.

I'm not sure why my sessions are being unpredictable.

On Saturday, March 2, 2013 5:52:24 PM UTC-6, Al Holden wrote:
Here's my theory:

Your table of users needs to contain a column for CF's session.sessionID variable.
Put it in there when the user joins the chat.

Your onSessionEnd function would start with something like this:
<cffunction name="onSessionEnd" returnType="void" output="false">
<cfargument name="sessionScope" type="struct" required="true">  
...

I'm pretty sure CF passes the (expiring) session object into the function when called. So your query would update your user table where [yourcolumnname] = '#sessionScope.sessionID#'

Totally untested, but that's what I'd try.
Al

P.S. Here's more from Ray:
http://ray.camdenfamily.com/index.cfm/2007/3/15/Counting-Sessions-with-Applicationcfc


On 3/2/2013 9:19 AM, Marcus F wrote:
In short, I've never used it before and can't figure out how to use it and pull the session variables.
Yes it's for cleaning up the userlist.

On Saturday, March 2, 2013 2:27:34 AM UTC-6, Al Holden wrote:
I think Marcus wants to tie the CF onSessionEnd event - to an update on
his own table of "currently chatting users".
Al

On 3/1/2013 11:50 PM, Alan Williamson wrote:
> what is the problem?
>
> Are you finding it is not being called?
>
> On 02/03/2013 00:24, Marcus F wrote:
>> I'm building a small chat, it's going great, lots of ajax goodness
>> and whatnot.
>> But I'm having an issue with cleaning up inactive users, since I use
>> ajax I guess sessiontimeout can be set low, but I can't figure out
>> how to use onsessionend to remove inactive users from the userlist.
>>
>> Could someone explain or link to a few examples on how to use it?
>

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openbd+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to