Skip to content

fix: settle WebSocket unsubscribe requests on failure - #5576

Closed
yinbowen-dc wants to merge 2 commits into
wevm:mainfrom
yinbowen-dc:codex/fix-5564-websocket-unsubscribe
Closed

yinbowen-dc wants to merge 2 commits into
wevm:mainfrom
yinbowen-dc:codex/fix-5564-websocket-unsubscribe

Conversation

@yinbowen-dc

Copy link
Copy Markdown
Contributor

Fixes #5564.

Use the existing requestAsync path for eth_unsubscribe so socket errors reject the promise, missing replies respect the transport timeout, and pending callbacks are removed on settlement. The normal RPC response shape remains unchanged.

Validation: the real WebSocket disconnect regression hangs on main. All 10 related tests pass with the fix, covering successful unsubscribe, peer disconnect, withheld replies, request cleanup and subscription cleanup. Biome passed. Includes a patch changeset. Full project types currently require generated test-contract artifacts.

The test accepts the native WebSocket ErrorEvent as a rejection value; it does not assume every runtime reports an Error instance.

AI assistance: prepared and tested with Codex at the account owner's request.

@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

@yinbowen-dc is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a3a1f0

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

jxom commented Nov 18, 2026

Copy link
Copy Markdown
Member

Thanks @yinbowen-dc! I've carried this forward in #5584, which keeps your commits and adds an unhandled-rejection guard, the same fix for IPC, and the tests moved into webSocket.test.ts. Closing in favor of that PR.

@jxom jxom closed this Nov 18, 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.

webSocket transport: unsubscribe() never settles when the socket is closed

2 participants