denoland/celldPublic

self-hosted, distributed Durable Objects

Are WebSockets in Durable Object facets intended to be supported?

DI

Hi! I'm trying to use WebSockets inside a Durable Object facet loaded through the Worker Loader.

The setup is a supervisor DO that gets a class from a loaded Worker, creates the facet with `ctx.facets.get()`, and forwards the request with `return facet.fetch(request)`. Regular HTTP requests work, but a WebSocket upgrade doesn't establish a connection when the facet returns a `101` response with a `WebSocketPair`.

The facet's handler looks like this:

```js fetch() { const [client, server] = Object.values(new WebSocketPair()); this.ctx.acceptWebSocket(server); return new Response(null, { status: 101, webSocket: client }); }

webSocketMessage(socket, message) { socket.send(message); } ```

I'm seeing this with celld 0.6.0 on macOS arm64, running locally with `celld dev`.

I found #210, which seems to describe the same problem. It was closed as not planned, but I couldn't find a comment explaining whether this is an intentional limitation of facets.

Are WebSockets in DO facets intended to be supported? And if this is missing functionality rather than an intentional restriction, would you be interested in a contribution to bring it closer to Cloudflare's facet behavior, including WebSocket hibernation? Happy to discuss what scope would make sense.

  1. bartlomiejuclosedlast month on GitHub

  2. bartlomiejureferenced 655ff6caf8b6last month on GitHub

  3. bartlomiejureferenced 90b43017241flast month on GitHub

  4. BA

    Fixed in v0.6.2: WebSockets work in Durable Object facets, including outbound sockets that a facet opens.