@graphql-yoga/plugin-graphql-sse
Version:
GraphQL over Server-Sent Events Protocol plugin for GraphQL Yoga.
16 lines (15 loc) • 741 B
TypeScript
import { Plugin, PubSub, YogaInitialContext } from 'graphql-yoga';
export interface GraphQLSSEPluginOptions {
pubsub: PubSub<{
'graphql-sse-subscribe': [string, string];
'graphql-sse-unsubscribe': [string, boolean];
}>;
}
/**
* 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, {
waitUntil(p: Promise<unknown>): void;
}>;