UNPKG

@graphql-yoga/plugin-graphql-sse

Version:

GraphQL over Server-Sent Events Protocol plugin for GraphQL Yoga.

18 lines (17 loc) 926 B
import { Plugin, YogaInitialContext } from 'graphql-yoga'; import { HandlerOptions } from 'graphql-sse'; import { RequestContext } from 'graphql-sse/lib/use/fetch'; export interface GraphQLSSEPluginOptions extends Omit<HandlerOptions<Request, RequestContext, any>, 'validate' | 'execute' | 'subscribe' | 'schema' | 'onSubscribe'> { /** * Endpoint location where GraphQL over SSE will be served. * * @default '/graphql/stream' */ endpoint?: string; } /** * Get [GraphQL over Server-Sent Events Protocol](https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md) integration with GraphQL Yoga by simply installing this plugin! * * Note that the endpoint defaults to `/graphql/stream`, this is where your [graphql-sse](https://github.com/enisdenjo/graphql-sse) client should connect. */ export declare function useGraphQLSSE(options?: GraphQLSSEPluginOptions): Plugin<YogaInitialContext>;