Socket.io maintains client side connection when client refreshes or opens a new page
Is there a way to keep the same socket.io connection on the client side, if the user opens a new page or refreshes the page, maybe keep the socket in the session or is it not possible?
It's impossible. You cannot keep the same socket.io or webSocket connection on page change or refresh. The browser just doesn't. When a new page is loaded or the current page is refreshed, all resources from the previous page are closed and released by the browser, including socket.io/webSocket connections.
So, your server should be waiting for a new socket.io connection from the recently loaded page. If you are using cookies or a server side session object, you can tell on the server when a connection comes from the client you previously saw, and then the server can act accordingly to understand that it is just a previous client reconnecting on a new page ...