This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
forked from apollographql/subscriptions-transport-ws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from runway/sam/updates
commit dist
- Loading branch information
Showing
37 changed files
with
3,631 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
coverage | ||
typings | ||
npm-debug.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { ListenerFn } from "eventemitter3"; | ||
import { ExecutionResult } from "graphql/execution/execute"; | ||
import { DocumentNode } from "graphql/language/ast"; | ||
export interface Observer<T> { | ||
next?: (value: T) => void; | ||
error?: (error: Error) => void; | ||
complete?: () => void; | ||
} | ||
export interface Observable<T> { | ||
subscribe(observer: Observer<T>): { | ||
unsubscribe: () => void; | ||
}; | ||
} | ||
export interface OperationOptions { | ||
query?: string | DocumentNode; | ||
variables?: Object; | ||
operationName?: string; | ||
[key: string]: any; | ||
} | ||
export declare type FormatedError = Error & { | ||
originalError?: any; | ||
}; | ||
export interface Operation { | ||
options: OperationOptions; | ||
handler: (error: Error[], result?: any) => void; | ||
} | ||
export interface Operations { | ||
[id: string]: Operation; | ||
} | ||
export interface Middleware { | ||
applyMiddleware(options: OperationOptions, next: Function): void; | ||
} | ||
export declare type ConnectionParams = { | ||
[paramName: string]: any; | ||
}; | ||
export declare type ConnectionParamsOptions = ConnectionParams | Function | Promise<ConnectionParams>; | ||
export interface ClientOptions { | ||
connectionParams?: ConnectionParamsOptions; | ||
minTimeout?: number; | ||
timeout?: number; | ||
reconnect?: boolean; | ||
reconnectionAttempts?: number; | ||
connectionCallback?: (error: Error[], result?: any) => void; | ||
lazy?: boolean; | ||
inactivityTimeout?: number; | ||
wsOptionArguments?: any[]; | ||
} | ||
export declare class SubscriptionClient { | ||
client: any; | ||
operations: Operations; | ||
private url; | ||
private nextOperationId; | ||
private connectionParams; | ||
private minWsTimeout; | ||
private wsTimeout; | ||
private unsentMessagesQueue; | ||
private reconnect; | ||
private reconnecting; | ||
private reconnectionAttempts; | ||
private backoff; | ||
private connectionCallback; | ||
private eventEmitter; | ||
private lazy; | ||
private inactivityTimeout; | ||
private inactivityTimeoutId; | ||
private closedByUser; | ||
private wsImpl; | ||
private wsProtocols; | ||
private wasKeepAliveReceived; | ||
private tryReconnectTimeoutId; | ||
private checkConnectionIntervalId; | ||
private maxConnectTimeoutId; | ||
private middlewares; | ||
private maxConnectTimeGenerator; | ||
private wsOptionArguments; | ||
constructor(url: string, options?: ClientOptions, webSocketImpl?: any, webSocketProtocols?: string | string[]); | ||
get status(): any; | ||
close(isForced?: boolean, closedByUser?: boolean): void; | ||
request(request: OperationOptions): Observable<ExecutionResult>; | ||
on(eventName: string, callback: ListenerFn, context?: any): Function; | ||
onConnected(callback: ListenerFn, context?: any): Function; | ||
onConnecting(callback: ListenerFn, context?: any): Function; | ||
onDisconnected(callback: ListenerFn, context?: any): Function; | ||
onReconnected(callback: ListenerFn, context?: any): Function; | ||
onReconnecting(callback: ListenerFn, context?: any): Function; | ||
onError(callback: ListenerFn, context?: any): Function; | ||
unsubscribeAll(): void; | ||
applyMiddlewares(options: OperationOptions): Promise<OperationOptions>; | ||
use(middlewares: Middleware[]): SubscriptionClient; | ||
private getConnectionParams; | ||
private executeOperation; | ||
private getObserver; | ||
private createMaxConnectTimeGenerator; | ||
private clearCheckConnectionInterval; | ||
private clearMaxConnectTimeout; | ||
private clearTryReconnectTimeout; | ||
private clearInactivityTimeout; | ||
private setInactivityTimeout; | ||
private checkOperationOptions; | ||
private buildMessage; | ||
private formatErrors; | ||
private sendMessage; | ||
private sendMessageRaw; | ||
private generateOperationId; | ||
private tryReconnect; | ||
private flushUnsentMessagesQueue; | ||
private checkConnection; | ||
private checkMaxConnectTimeout; | ||
private connect; | ||
private processReceivedData; | ||
private unsubscribe; | ||
} |
Oops, something went wrong.