How does gatewayWorker jump to open connections in the same window in a browser?

recently, I am doing a page version of the chat room. Every time the front end refreshes the page, I have to reconnect to the background. I feel that this is a waste of resources. I want to control the continuous connection when I jump under the same window. Is there anything we can do?
public static function onConnect ($client_id)
{

//

}

Jul.19,2021

refreshing the browser will destroy all resources on the current page, and the connection must be disconnected. This is the mechanism of the browser. The code cannot control


the front end uses vue to find out.

Menu