UNPKG

1.48 kBTypeScriptView Raw
1import { execute as graphqlExecute, GraphQLSchema, subscribe as graphqlSubscribe } from 'graphql';
2import { ServerOptions } from 'graphql-ws';
3import { ServerOptions as SubscriptionTransportWsServerOptions } from 'subscriptions-transport-ws';
4export declare type GraphQLWsSubscriptionsConfig = Partial<Pick<ServerOptions, 'connectionInitWaitTimeout' | 'onConnect' | 'onDisconnect' | 'onClose' | 'onSubscribe' | 'onNext'>> & {
5 path?: string;
6};
7export declare type GraphQLSubscriptionTransportWsConfig = Partial<Pick<SubscriptionTransportWsServerOptions, 'onConnect' | 'onDisconnect' | 'onOperation' | 'keepAlive'>> & {
8 path?: string;
9};
10export declare type SubscriptionConfig = {
11 'graphql-ws'?: GraphQLWsSubscriptionsConfig | boolean;
12 'subscriptions-transport-ws'?: GraphQLSubscriptionTransportWsConfig | boolean;
13};
14export interface GqlSubscriptionServiceOptions extends SubscriptionConfig {
15 schema: GraphQLSchema;
16 execute?: typeof graphqlExecute;
17 subscribe?: typeof graphqlSubscribe;
18 path?: string;
19 context?: ServerOptions['context'];
20}
21export declare class GqlSubscriptionService {
22 private readonly options;
23 private readonly httpServer;
24 private readonly wss;
25 private readonly subTransWs;
26 private wsGqlDisposable;
27 private subServer;
28 constructor(options: GqlSubscriptionServiceOptions, httpServer: any);
29 private initialize;
30 stop(): Promise<void>;
31}
32//# sourceMappingURL=gql-subscription.service.d.ts.map
\No newline at end of file