Setu-TS
    Preparing search index...

    Function isWebSocketUpgradeRequest

    • Reports whether a set of request headers describes an RFC 6455 WebSocket upgrade.

      Both conditions are required, per RFC 6455 §4.2.1: Upgrade must equal websocket (case-insensitively), and Connection must contain the upgrade token. Connection is a comma-separated list — proxies routinely send keep-alive, Upgrade — so it is matched token-wise rather than by substring, which would also match a header value such as no-upgrade.

      Lives here rather than in @setu-ts/runtime because the kernel decides whether a request is an upgrade (after the pipeline runs) while the adapters still need the identical rule, and the kernel does not depend on the runtime package. A pure predicate is exactly what common is for (AI_GUIDELINES §2.1); @setu-ts/runtime re-exports this one rather than keeping a second copy (§11.1).

      Parameters

      • headers: Headers

        The request headers

      Returns boolean

      true when the request asks for a WebSocket upgrade

      if (isWebSocketUpgradeRequest(request.headers)) {
      // consult the upgrade router
      }

      0.3.0