UNPKG

1.11 kBTypeScriptView Raw
1import { INestApplicationContext, WebSocketAdapter } from '@nestjs/common';
2import { WsMessageHandler } from '@nestjs/common/interfaces';
3import { Observable } from 'rxjs';
4export interface BaseWsInstance {
5 on: (event: string, callback: Function) => void;
6 close: Function;
7}
8export declare abstract class AbstractWsAdapter<TServer extends BaseWsInstance = any, TClient extends BaseWsInstance = any, TOptions = any> implements WebSocketAdapter<TServer, TClient, TOptions> {
9 protected readonly httpServer: any;
10 private _forceCloseConnections;
11 set forceCloseConnections(value: boolean);
12 get forceCloseConnections(): boolean;
13 constructor(appOrHttpServer?: INestApplicationContext | any);
14 bindClientConnect(server: TServer, callback: Function): void;
15 bindClientDisconnect(client: TClient, callback: Function): void;
16 close(server: TServer): Promise<void>;
17 dispose(): Promise<void>;
18 abstract create(port: number, options?: TOptions): TServer;
19 abstract bindMessageHandlers(client: TClient, handlers: WsMessageHandler[], transform: (data: any) => Observable<any>): any;
20}