Summary
After namespaced pub/sub (e.g. #162), AttachedState includes optional n (connection namespace) and _restore reads namespace || state.n || "". If the namespace is not written into the serialized attachment before setAttachedState, hibernation / attachment-only restore can deserialize a state with no n, yielding an empty namespace and triggering getPeers → "Websocket publish namespace missing." on close or pub/sub paths.
Suggested fix
In CloudflareDurablePeer._restore, after assigning state.i = peer.id (and any state.u updates), persist the namespace:
state.n = peer.namespace;
setAttachedState(ws, state);
This matches the intent of state.n on AttachedState and ensures the next serializeAttachment round-trip keeps the namespace across DO WebSocket hibernation.
Context
Consumers may work around this with a pnpm patch on dist/adapters/cloudflare.mjs (e.g. state.n = peer.namespace before setAttachedState). Upstream fix would allow dropping that patch.
Environment
crossws with Cloudflare Durable Objects adapter, ctx.acceptWebSocket, peer restored from attachment without a fresh upgrade request carrying namespace.
Summary
After namespaced pub/sub (e.g. #162),
AttachedStateincludes optionaln(connection namespace) and_restorereadsnamespace || state.n || "". If the namespace is not written into the serialized attachment beforesetAttachedState, hibernation / attachment-only restore can deserialize a state with non, yielding an empty namespace and triggeringgetPeers→ "Websocket publish namespace missing." on close or pub/sub paths.Suggested fix
In
CloudflareDurablePeer._restore, after assigningstate.i = peer.id(and anystate.uupdates), persist the namespace:This matches the intent of
state.nonAttachedStateand ensures the nextserializeAttachmentround-trip keeps the namespace across DO WebSocket hibernation.Context
Consumers may work around this with a pnpm patch on
dist/adapters/cloudflare.mjs(e.g.state.n = peer.namespacebeforesetAttachedState). Upstream fix would allow dropping that patch.Environment
crosswswith Cloudflare Durable Objects adapter,ctx.acceptWebSocket, peer restored from attachment without a fresh upgrade request carryingnamespace.