-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
27 lines (23 loc) · 1.04 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { MercuriusContext } from "mercurius";
import { EventEmitter } from "stream";
export interface SubscriptionClientConfig {
protocols?: Array<string>,
reconnect?: boolean,
maxReconnectAttempts?: number,
serviceName: string,
connectionCallback?: (params: any) => Promise<void>,
failedConnectionCallback?: (params: any) => Promise<void>,
failedReconnectCallback?: (params: any) => Promise<void>,
connectionInitPayload?: any,
rewriteConnectionInitPayload?: (connectionInit: any, context: MercuriusContext) => void,
keepAlive?: number
}
export type SubscriptionOperationId = string
export class SubscriptionClient extends EventEmitter {
constructor(uri: string, config: SubscriptionClientConfig)
connect(): void
close (tryReconnect: boolean, closedByUser?: boolean): void
unsubscribe (operationId: SubscriptionOperationId, forceUnsubscribe?: boolean) : void
unsubscribeAll() : void
createSubscription (query: string, variables: any, publish: (props: any) => Promise<void>, context: MercuriusContext) : SubscriptionOperationId
}