Please see how NetEase station to determine whether a user is still online (write community problems)

Source: Internet
Author: User
Tags current time
Community | problem | Online In fact, NetEase also took the foreign code to change the next to do their own intake. The code seems to be on a foreign website, you can find out how it will be.

In addition, NetEase judge a user online or not, I think this way can be achieved.

1, log in, the user information recorded in a table. Where the critical data is the current logon time. At the same time to
to a

A number that the user uniquely identifies.

2, NetEase's pages are constantly automatically refreshed. Please note that the page:

<meta http-equiv= "Refresh"
Content= "20;url=http://club.netease.com:8888/xxxx" >

Where the URL should be an address that is specifically used to authenticate the re-registration. XXXX is and personal information
Related

A string that is the unique identification number of the user mentioned above. Each refresh, in fact, is to modify the table in the
The mind of the household

The current time in the record is the present time.

3, each operation needs to authenticate the user identity. The process of authenticating a user should be:

A, judge whether the person is A user;

B, remove the list of online people from the current online table and see if the person is in the list. If not, it must be a super

When If in, that operation continues. How to tell a timeout is actually a question of how to determine the list of online people
Problem. Assume

10 minutes timeout, then the online table is in fact all eligible: current time-Last registration time <10 minutes
For all

Recording. This last registration time is the time to fill in when the page is refreshed.

4, the regular emptying of the record of the personnel, to maintain the size of the table and improve the efficiency of the search.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.