graphql-ws / server
Ƭ GraphQLExecutionContextValue: object
| symbol
| number
| string
| boolean
| undefined
| null
A concrete GraphQL execution context value type.
Mainly used because TypeScript collapes unions
with any
or unknown
to any
or unknown
. So,
we use a custom type to allow definitions such as
the context
server option.
Ƭ OperationResult: Promise
<AsyncGenerator
<ExecutionResult
| ExecutionPatchResult
> | AsyncIterable
<ExecutionResult
| ExecutionPatchResult
> | ExecutionResult
> | AsyncGenerator
<ExecutionResult
| ExecutionPatchResult
> | AsyncIterable
<ExecutionResult
| ExecutionPatchResult
> | ExecutionResult
▸ 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.
Name | Type |
---|---|
protocols |
string | string [] | Set <string > |
typeof GRAPHQL_TRANSPORT_WS_PROTOCOL
| false
▸ makeServer<P
, E
>(options
): Server
<E
>
Makes a Protocol complient WebSocket GraphQL server. The server is actually an API which is to be used with your favourite WebSocket server library!
Read more about the Protocol in the PROTOCOL.md documentation file.
Name | Type |
---|---|
P |
extends undefined | Record <string , unknown > = undefined | Record <string , unknown > |
E |
unknown |
Name | Type |
---|---|
options |
ServerOptions <P , E > |
Server
<E
>