Documentation
Modules
server

Module: server

Interfaces

Server

GraphQLExecutionContextValue

Ƭ GraphQLExecutionContextValue: object | symbol | number | string | boolean | undefined | null

A concrete GraphQL execution context value type.

Mainly used because TypeScript collapses unions with any or unknown to any or unknown. So, we use a custom type to allow definitions such as the context server option.

Defined in

src/server.ts:67


OperationResult

Ƭ OperationResult: Promise<AsyncGenerator<ExecutionResult | ExecutionPatchResult> | AsyncIterable<ExecutionResult | ExecutionPatchResult> | ExecutionResult> | AsyncGenerator<ExecutionResult | ExecutionPatchResult> | AsyncIterable<ExecutionResult | ExecutionPatchResult> | ExecutionResult

Defined in

src/server.ts:47


handleProtocols

handleProtocols(protocols): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false

Helper utility for choosing the “graphql-transport-ws” subprotocol from a set of WebSocket subprotocols.

Accepts a set of already extracted WebSocket subprotocols or the raw Sec-WebSocket-Protocol header value. In either case, if the right protocol appears, it will be returned.

By specification, the server should not provide a value with Sec-WebSocket-Protocol if it does not agree with client’s subprotocols. The client has a responsibility to handle the connection afterwards.

Parameters

NameType
protocolsstring | string[] | Set<string>

Returns

typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false

Defined in

src/server.ts:890


makeServer

makeServer<P, E>(options): Server<E>

Makes a Protocol compliant WebSocket GraphQL server. The server is actually an API which is to be used with your favourite WebSocket server library!

Read more about the GraphQL over WebSocket Protocol.

Type parameters

NameType
Pextends undefined | Record<string, unknown> = undefined | Record<string, unknown>
Eunknown

Parameters

NameType
optionsServerOptions<P, E>

Returns

Server<E>

Defined in

src/server.ts:533