在Flex客户端从BlazeDS目标断开连接时检测(在服务器端) [英] Detecting (on the server side) when a Flex client disconnects from BlazeDS destination

查看:158
本文介绍了在Flex客户端从BlazeDS目标断开连接时检测(在服务器端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道当Flex客户端与BlazeDS目标断开连接时,是否可以轻松检测(在服务器端)?我的情况是,我想尝试使用这个来确定每个客户端连接了多长时间。我需要能够区分客户端(即不仅仅是统计我在ds-console中看到的当前连接的客户端的数量)。



虽然我可以在我的客户的我正在注销程序中进行编程,但是我不知道如果客户只是导航到另一个网页,而不是通过所述注销过程。



任何人都可以建议是否有简单的方法在服务器端进行这种类型的监控。非常感谢,
Alex

解决方案

唯一的方法就是以某种方式实现心跳机制另一个。你可以像前面所建议的那样,使用http的keep-alive和session expire,但是我的意见是使用BlazeDS的消息机制(在X秒发送消息)。您可以控制时间间隔和其他方面(也许您想要检测客户端是否在几个小时内没有做任何事情,并且即使您的客户端仍然连接也无效)。

如果您希望立即得到通知(聊天应用程序),当客户端断开连接时,解决方案是使用套接字(RTMP)或一些仿真(http流),即时检测客户端是否断开连接,可能是暂时的(也许网络关闭了一秒钟,之后是好的,你也应该检测到这一点)。


I'd like to know whether it's possible to easily detect (on the server side) when Flex clients disconnect from a BlazeDS destination please? My scenario is simply that I'd like to try and use this to figure out how long each of my clients are connected for each session. I need to be able to differentiate between clients as well (ie so not just counting the number of currently connected clients which I see in ds-console).

Whilst I could program in a "I'm now logging out" process in my clients, I don't know whether this will fire if the client simply navigates away to another web page rather than going though said logout process.

Can anyone suggest if there's an easy way to do this type of monitoring on the server side please.

Many thanks, Alex

解决方案

The only way to do it right is to implement the heartbeat mechanism in a way or another. You can use the keep-alive from http coupled with session expire as suggested before but my opinion is to use the messaging mechanism from BlazeDS (send a message at X seconds). You can control the time interval and other aspects (maybe you want to detect if the client is not doing anything for several hours and to invalidate the session even if your client is still connected).

If you want to be notified instantly (chat application) when a client is disconnecting a solution is to have a socket (RTMP) or some emulation (http streaming) which will detect instantly if the client is disconnected, however this disconnection can be temporary (maybe the network was down for one second, and after that is ok, and you should also detect that).

这篇关于在Flex客户端从BlazeDS目标断开连接时检测(在服务器端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆