Clear out peerId on disconnect to prevent sending messages to a dead topic #682
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a bug that's very problematic on OpenSea where disconnecting -> connecting through QR code flow again will never result in a working session unless you clear out application cache. I am able to reproduce this in a local setup as well.
Steps to reproduce bug on OpenSea:
If you look at the websocket traffic, you'll see that it is publishing new events to the old
peerId
. I've pasted example data below where you can see thepeerId
(from perspective of OpenSea) on the first session302c451f-d12c-4c0a-af9c-e26780ae2831
is reused on the second session instead of8862c7ff-6ec0-45a1-b7ff-278f608159e5
.From Rainbow - Initial Session:
OpenSea WalletConnect Traffic - Initial Session
From Rainbow - Second Session (after disconnect):
OpenSea WalletConnect Traffic - Second Session (after disconnect):