Socket Server-phpsocket persistent connection

Source: Internet
Author: User
When developing php-based im communication tools on the server (web or app may be used), generally, http is used for logon and registration, this part can be implemented through nginx or apache. persistent connection message push. the socket persistent connection must be independent on the server... when developing php-based im communication tools on the server (web or app may be used), generally, http is used for logon and registration, this part can be implemented through nginx or apache. the persistent connection message push module uses the socket persistent connection. the socket persistent connection on the server must be a separate service to push data, so how does the server verify the validity of the client connection when the client sends messages based on the socket persistent connection? how is a general verification solution designed?

Reply content:

When developing php-based im communication tools on the server (web or app may be used), generally, http is used for logon and registration, this part can be implemented through nginx or apache. the persistent connection message push module uses the socket persistent connection. the socket persistent connection on the server must be a separate service to push data, so how does the server verify the validity of the client connection when the client sends messages based on the socket persistent connection? how is a general verification solution designed?

You can try to refer to the WorkerMan framework.
In the aspect of verification, it should be safer to use the token of regular update. during each connection, a token based on user information and randomization will be generated.

The most popularSwooleIs to solve this problem.

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.