Use useWebSocket with shared connections
masterIf multiple components pass the same socketUrl to useWebSocket and the share option is set to true, only a single WebSocket will be created. The hook manages subscriptions/unsubscriptions internally. The WebSocket is automatically cleaned up from memory once all subscribers have unmounted or changed their socketUrl.
When sharing, getWebSocket() returns a proxy-wrapped WebSocket that provides controlled access to the underlying shared connection without allowing unsafe behavior.