WalletConnect / walletconnect-monorepo

WalletConnect Monorepo
Apache License 2.0
1.25k stars 617 forks source link

relay.walletconnect.com websocket connection is opened even though there is no action and no topic subscriptions #4450

Closed chris13524 closed 1 month ago

chris13524 commented 1 month ago

Describe the bug A WebSocket connection is opened in an private browser window before I even open the modal. It was described that the WebSocket connection isn't needed unless there is a subscribed topic. However it will still open the connection initially but then close it without any messages going through it.

Slack conversation

SDK Version (if relevant) latest

To Reproduce Steps to reproduce the behavior:

  1. Go to https://lab.web3modal.com/library/wagmi/
  2. Observe a WebSocket connection is opened to relay.walletconnect.com
  3. WebSocket connection is then closed

Expected behavior A WebSocket isn't opened until an action is performed that requires it (e.g. generating the QR code).

Screenshots

image

linear[bot] commented 1 month ago

CR-8 relay.walletconnect.com websocket connection is opened even though there is no action and no subscriptions

ganchoradkov commented 1 month ago

Hey @chris13524 this is done by design. The websocket is opened on client init to validate that the connection can actually be established. Think of the cases where projectid is missing/invalid, jwt is invalid etc. It would only be caught when user tries to interact with the client and might mislead devs into thinking that since client inits, all is good while that isn't the case