connect-bidi-web
    Preparing search index...
    • Creates a fetch-handler helper that upgrades Upgrade: websocket requests into a multiplexed bidi connection, bridged to handlers via @sudorandom/connect-bidi-core's handleMuxedBidiSocket. Get handlers from createConnectRouter(...).handlers (@connectrpc/connect).

      The returned function returns the 101 upgrade Response for WebSocket upgrade requests, or null for everything else, so callers can fall through to their own Connect-over-fetch handling:

      const bidiWebSocket = createBidiWebSocketHandler(handlers);

      export default {
      fetch(request: Request): Response | Promise<Response> {
      return bidiWebSocket(request) ?? handleConnectFetch(request);
      },
      };

      One WebSocket connection carries any number of concurrent RPCs, demultiplexed by the stream ID on every frame, matching the Go and Node adapters.

      Parameters

      Returns (request: Request) => Response | null