About the client validity of websocket

Source: Internet
Author: User
Recently, I am working on a websocket project. I don't understand many things for the first time, so I want to ask a question: If many client links come up, how can I verify the validity of this client? I read the handshake protocol and it seems that I can't do anything. Thank you for your guidance. Recently, I am working on a websocket project. I don't understand many things for the first time, so I want to ask a question: If many client links come up, how can I verify the validity of this client? I read the handshake protocol and it seems that I can't do anything. Thank you for your guidance.

Reply content:

Recently, I am working on a websocket project. I don't understand many things for the first time, so I want to ask a question: If many client links come up, how can I verify the validity of this client? I read the handshake protocol and it seems that I can't do anything. Thank you for your guidance.

I have never done it. it may be like this if I want to do it:
1. when creating a socket connection, you must send the cookie information of the current site once, for example, PHPSESSID.
2. if this user logs on, the web server will record the user's session (for example, in the database or cache), and the socket server will verify whether the session exists at the same place, or call the interface.

Send the user's sessionidto the server. the server reads session data from the disk or storage based on the sessionid to know whether the user is logged on.

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.