You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
partyserver: with hibernation off, a client close without a status code (1005) is never answered, so the client stays in CLOSING #429
Since #394, closeQuietly skips the reply for the reserved codes 1005, 1006 and 1015. 1006 and 1015 mean that no Close frame arrived. 1005 does not: it is what the server reports when the client sent a real Close frame with an empty body, which is what ws.close() with no arguments does. The transport is still open, and the client waits in CLOSING for the server's Close frame.
On a non-hibernating server (static options = { hibernate: false }) that frame never comes. y-partyserver's provider calls ws.close() with no code in disconnect(), so every YProvider.disconnect() ends this way. The provider keeps wsconnected === true until the socket finally dies, and a connect() in the meantime does nothing.
The #394 notes say compatibility dates on or after 2026-04-07 auto-reply to Close frames. That does not happen for these sockets: the result below is on compatibility date 2026-11-01.
Start a YServer subclass with hibernate: false (for example via unstable_startWorker).
Open a raw WebSocket to /parties/<party>/<room>, wait for open, then call ws.close() with no code.
With the stock onClose, the client is still in readyState 2 (CLOSING) after 6000 ms.
Add if (code === 1005) connection.close(1000, 'Closed') to onClose. The close completes in 14 ms and the client sees 1000.
In our production Worker that reply has run on every pause, reload and tab close since 2026-11-09. wrangler tail during a test run (57 events) showed no exceptions and no Network connection lost rejections.
Suggested fix: in closeQuietly, skip the reply only for 1006 and 1015. For 1005, reply with ws.close() (no code) or with 1000. A peer that sent a code-less Close frame is still there to receive the answer.
Confirming this on a deployed Worker. I hit it with partyserver 0.5.10, y-partyserver 2.2.0 and wrangler 4.156.0, on compatibility date 2026-10-23, with the default hibernate: false.
Trigger:YProvider.disconnect() followed by connect() in the same page. The old socket never gets a close event, no new socket opens, and the provider stays "connecting" for more than 10 s.
Local dev doesn't show it: under @cloudflare/vite-plugin / local workerd the close completes at once, so for me a local e2e suite passes. It only failed against the workers.dev deployment, and it failed every time (6/6).
The workaround fixes it: with the onClose workaround from the issue (if (code === 1005) connection.close(1000, …)), the reconnect takes about 0.5 s, and my e2e suite passed.
There's a Playwright repro in KarolNov/duratom#9 (examples/sync). Its test "concurrent offline edits to one title both survive" fails against a deployment without the workaround in worker/index.ts. Running it with E2E_BASE_URL=<workers.dev URL> targets a deployment.
+1 to the suggested fix of not skipping the reply for 1005.
Activity
KarolNov commentedon Nov 14, 2026
Confirming this on a deployed Worker. I hit it with partyserver 0.5.10, y-partyserver 2.2.0 and wrangler 4.156.0, on compatibility date 2026-10-23, with the default
hibernate: false.YProvider.disconnect()followed byconnect()in the same page. The old socket never gets acloseevent, no new socket opens, and the provider stays "connecting" for more than 10 s.@cloudflare/vite-plugin/ local workerd the close completes at once, so for me a local e2e suite passes. It only failed against theworkers.devdeployment, and it failed every time (6/6).onCloseworkaround from the issue (if (code === 1005) connection.close(1000, …)), the reconnect takes about 0.5 s, and my e2e suite passed.There's a Playwright repro in KarolNov/duratom#9 (
examples/sync). Its test "concurrent offline edits to one title both survive" fails against a deployment without the workaround inworker/index.ts. Running it withE2E_BASE_URL=<workers.dev URL>targets a deployment.+1 to the suggested fix of not skipping the reply for 1005.