Skip to content

fix(transports): unsubscribe with the current id after a WebSocket/IPC reconnect - #5213

Merged
jxom merged 1 commit into
wevm:mainfrom
EperezOk:fix/socket-resubscribe-id
Oct 11, 2026
Merged

jxom merged 1 commit into
wevm:mainfrom
EperezOk:fix/socket-resubscribe-id

Conversation

@EperezOk

@EperezOk EperezOk commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5212.

On reconnect, the socket client re-subscribes and the node assigns a new subscription id, but unsubscribe() kept using the original one, so the subscription leaked.

  • utils/rpc/socket.ts: the subscription entry stores the subscriber's onResponse, so the re-subscribe confirmation (with the new id) reaches the subscriber instead of being dropped by the original request's id filter.
  • webSocket / ipc transports: keep subscriptionId up to date and unsubscribe with it. If the re-subscribe confirmation arrives after unsubscribe() was called, the new subscription is unsubscribed too.

@changeset-bot

changeset-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f59472c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@EperezOk is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom
jxom merged commit dd73698 into wevm:main Oct 11, 2026
2 of 3 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unsubscribe() leaks the subscription after a WebSocket reconnect

2 participants