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