aboutsummaryrefslogtreecommitdiff
path: root/source/http.ts
diff options
context:
space:
mode:
authornetop://ウィビ <paul@webb.page>2026-05-03 12:40:04 -0700
committernetop://ウィビ <paul@webb.page>2026-05-03 12:40:04 -0700
commit52ee736bd2ac407952863c8e8397770bf1495a45 (patch)
treef982218600682f7714a5a5157e940acc0e0e8a13 /source/http.ts
parent83f2352fef7dc93396e3cf8f224acba271f1ef9d (diff)
downloadgq-52ee736bd2ac407952863c8e8397770bf1495a45.tar.gz
gq-52ee736bd2ac407952863c8e8397770bf1495a45.zip
adds support for subscriptions
Diffstat (limited to 'source/http.ts')
-rwxr-xr-xsource/http.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/http.ts b/source/http.ts
index 7c747e1..c4a70c8 100755
--- a/source/http.ts
+++ b/source/http.ts
@@ -54,6 +54,9 @@ export function GraphQLHTTP<
...options
}: GQLOptions<Ctx, Req>): GraphQLHandler<Req> {
return async (request: Req) => {
+ if (options.subscriptions && request.headers.get("upgrade")?.toLowerCase() === "websocket")
+ return options.subscriptions(request as unknown as Request);
+
const accept = request.headers.get("Accept") || "";
const typeList = ["application/json", "text/html", "text/plain", "*/*"]