Connection go down when user pass from domain A to domain B then domain A. The "service" doesn t seams to work as a service in this case.
What would you expect to happen? What if the user is on domain B for 3 days before returning to domain A?
If it called service i would image might work in background (or simulate to work in background ) with all the resources offered by html5. The connection might remain active until server decides to close . A connection is use full if it can be used for long time . If every time user change page the connection is closed and reloaded server receives a overload , web socket was designed for removing overload in http protocol but now overload is moved in server because there is no way to keep the connection active . Service worker could keep the connection active until server business logic decide to close.
A service for definition work independently by user interaction .
We can't keep web sockets open while the user is off the site for battery and privacy reasons. Web push is a better solution here.
Most helpful comment
We can't keep web sockets open while the user is off the site for battery and privacy reasons. Web push is a better solution here.