WebSocket questions about client legitimacy

Source: Internet
Author: User
Recently engaged in a websocket project, because the first time, a lot of things do not understand, so want to ask a question, is: If a lot of clients link up, then how can I verify the legitimacy of this client? I looked at the handshake protocol part, as if I could not do anything. Ask God for guidance, thank you.

Reply content:

Recently engaged in a websocket project, because the first time, a lot of things do not understand, so want to ask a question, is: If a lot of clients link up, then how can I verify the legitimacy of this client? I looked at the handshake protocol part, as if I could not do anything. Ask God for guidance, thank you.

I didn't do it, I could do it like this:
1. When creating a socket connection, it is required to send the identity cookie information of the current site, such as PHPSESSID.
2, if the user is logged in, the Web server will record the user's session (such as the database or cache), the socket server go to the same place to verify the existence of the session, or call the interface mode.

The user's sessionidsend to the server, the server based on the SessionID to disk or storage to read session data, we know whether the user is logged in, who is

  • 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.