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
OperationResult
Ƭ OperationResult: Promise
<AsyncGenerator
<ExecutionResult
| ExecutionPatchResult
> | AsyncIterable
<ExecutionResult
| ExecutionPatchResult
> | ExecutionResult
> | AsyncGenerator
<ExecutionResult
| ExecutionPatchResult
> | AsyncIterable
<ExecutionResult
| ExecutionPatchResult
> | ExecutionResult
Defined in
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
Name | Type |
---|---|
protocols | string | string [] | Set <string > |
Returns
typeof GRAPHQL_TRANSPORT_WS_PROTOCOL
| false
Defined in
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
Name | Type |
---|---|
P | extends undefined | Record <string , unknown > = undefined | Record <string , unknown > |
E | unknown |
Parameters
Name | Type |
---|---|
options | ServerOptions <P , E > |
Returns
Server
<E
>