Re: how to see all sessions sets in server
| From: | Stuart Dallas | Date: | Sun, 04 Aug 2013 13:59:31 +0000 |
| Subject: | Re: how to see all sessions sets in server | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321795@lists.php.net to get a copy of this message | ||
On 4 Aug 2013, at 14:36, Farzan Dalaee <farzan.dalaee@gmail.com> wrote:
> I need to inspect each visitor to show how online or who offline for chat
> Like facebook chat
PHP sessions is a really bad mechanism to use to accomplish this. In the past I've used
memcached or redis for presence indicators. Both allow you to set keys that expire after a set
period. The problem with this is that a user can appear to be online for up to "set
period" seconds longer than they actually are.
In the system I'm currently building I've got a node.js daemon to which the browser
connects. That daemon exposes an API that the rest of the system can call to get lists of online
users, which is easily gathered since it's just the list of connected users. There is then no
delay between the browser closing the connection and the daemon deciding that user is no longer
online.
If you have a chat system I'm curious as to how it works, since presence is usually tied
closely to how the client is detecting new messages.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/