Make the sockets open based on the status of the session instead of constantly operating.