开发者

how to auto refresh user list in chat

开发者 https://www.devze.com 2022-12-20 21:55 出处:网络
i am developing chat application using .net, here i have to re开发者_如何学JAVAfresh the online users periodically, is there any way please suggest me.

i am developing chat application using .net, here i have to re开发者_如何学JAVAfresh the online users periodically, is there any way please suggest me.

now i am getting user name once the user is logged in, and i am removing the user once he press the logout button, its ok and working fine, but some users just close their browser its not possible for me to identify whether he is in online or not, any help will be appreciated.


You can use some client side notification mechanism using stuff like AJAX (or ASP.NET AJAX). Have the client notify the server every 1-2 minutes to send a "I am alive" signal.


For a web app, Have a look at the Asp.NET AJAX Timer control (MSDN)

Also, see the JavaScript BODY onUnLoad event. It is fired when a browser window is closed or the user navigates away by changing the address bar URL or by clicking something etc.

For a form app, Have a look at the various timer controls

0

精彩评论

暂无评论...
验证码 换一张
取 消