I tried running it using shared workers. It works as expected with the exception for a single tab connection a single refresh still creates a new socket connection. I decided to try out service workers since it has a longer life span in contrast. However this fails at the point of creating the socket connection with the error Uncaught (in promise) ReferenceError: document is not defined
. Whats the best alternative for creating a single socket connection even for a single tab.
PS: using SSR