UNPKG

990 BTypeScriptView 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 constructor(appOrHttpServer?: INestApplicationContext | any);
11 bindClientConnect(server: TServer, callback: Function): void;
12 bindClientDisconnect(client: TClient, callback: Function): void;
13 close(server: TServer): Promise<void>;
14 dispose(): Promise<void>;
15 abstract create(port: number, options?: TOptions): TServer;
16 abstract bindMessageHandlers(client: TClient, handlers: WsMessageHandler[], transform: (data: any) => Observable<any>): any;
17}