Use BroadcastChannel; you don't need no sockets
https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_C...
https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_C...
Sounds like OP wanted to use sockets for fun though.
>The original work by Bjorn Staal used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.
Who among us hasn't overcomplicated things for fun? :)