Home > Backend Development > PHP Tutorial > socket server - php socket long connection

socket server - php socket long connection

WBOY
Release: 2016-07-06 13:52:12
Original
1733 people have browsed it

When developing a server-side IM communication tool based on PHP (which may be a web or an app), generally login and registration use the http protocol. For this part, just use nginx or apache. Long connection message push In this regard, the long socket connection is used. The long socket connection on the server side must be a separate service for pushing data. So when the client sends messages to the server based on the long socket connection, how does the server authenticate the client connection? What about the legality of it? How is the common verification scheme designed?

Reply content:

When developing a server-side IM communication tool based on PHP (which may be a web or an app), generally login and registration use the http protocol. For this part, just use nginx or apache. Long connection message push In this regard, the long socket connection is used. The long socket connection on the server side must be a separate service for pushing data. So when the client sends messages to the server based on the long socket connection, how does the server authenticate the client connection? What about the legality of it? How is the common verification scheme designed?

You can try to use the WorkerMan framework.
Using regularly updated tokens for verification should be a safer method. A token based on user information and randomization will be generated at each connection

Anyway, the most popular one swoole is to solve this problem.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template