Skip to content

Commit ec6968b

Browse files
committed
fix(grpahql_transport_ws): add picking sub-protocol for graphql-transport-ws
1 parent 52edba7 commit ec6968b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

deps.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,20 @@ export {
2525
validate,
2626
validateSchema,
2727
} from "https://esm.sh/[email protected]";
28-
export { Status } from "https://deno.land/std@0.150.0/http/http_status.ts";
28+
export { Status } from "https://deno.land/std@0.151.0/http/http_status.ts";
2929
export {
3030
createHttpError,
3131
HttpError,
32-
} from "https://deno.land/std@0.150.0/http/http_errors.ts";
33-
export { createHandler } from "https://deno.land/x/[email protected].1/mod.ts";
32+
} from "https://deno.land/std@0.151.0/http/http_errors.ts";
33+
export { createHandler } from "https://deno.land/x/[email protected].3/mod.ts";
3434
export {
3535
type GraphQLParameters,
3636
parseGraphQLParameters,
3737
} from "https://deno.land/x/[email protected]/mod.ts";
38-
export { parseMessage as parseServerMessage } from "https://deno.land/x/[email protected]/client/mod.ts";
39-
export {
40-
MessageType,
41-
type NextMessage,
42-
PrivateStatus,
43-
PROTOCOL,
44-
type SubscribeMessage,
45-
} from "https://deno.land/x/[email protected]/mod.ts";
4638
export {
4739
createClient,
4840
createServer,
41+
PROTOCOL,
4942
} from "https://deno.land/x/[email protected]/mod.ts";
5043

5144
// deno-lint-ignore no-explicit-any

graphql_transport_ws/handler.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
createHandler as createWsHandler,
33
createServer,
4+
PROTOCOL,
45
validateSchema,
56
} from "../deps.ts";
67
import { GraphQLExecutionArgs } from "../types.ts";
@@ -44,6 +45,12 @@ export default function createHandler(
4445
{ url: socket, schema: params.schema },
4546
params,
4647
);
48+
}, {
49+
protocol: (protocols) => {
50+
if (protocols.includes(PROTOCOL)) {
51+
return PROTOCOL;
52+
}
53+
},
4754
});
4855

4956
return handler;

0 commit comments

Comments
 (0)