Whether the socket_read in php will be disconnected if it hasn't received the message for a long time.

if the client uses socket_read, will the client disconnect from the server because the server does not send messages for a long time?
what should I do if there is a disconnection? (server-side code cannot be modified at this time)

while (1){
    $response = socket_read($socket,1024);
    //.....
}
Sep.22,2021

will not be disconnected automatically. The original purpose of using socket is to make a long connection
normally, heartbeat detection should be done. If the server sends messages, there will be problems if the client sends messages. For example, if the client network is disconnected, the server does not know.

Menu