How to broadcast message to all active websocket connections?

When I try to store the WebSocket object in an array and call send() on each of them I'll get

  Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams,
  request/response bodies, and others) created in the context of one request handler cannot be
  accessed from a different request's handler. This is a limitation of Cloudflare Workers which
  allows us to improve overall performance. (I/O type: Native)
Was this page helpful?