UNPKG

637 BTypeScriptView Raw
1import { Observable } from 'rxjs';
2/**
3 * @publicApi
4 */
5export interface WsMessageHandler<T = string> {
6 message: T;
7 callback: (...args: any[]) => Observable<any> | Promise<any>;
8}
9/**
10 * @publicApi
11 */
12export interface WebSocketAdapter<TServer = any, TClient = any, TOptions = any> {
13 create(port: number, options?: TOptions): TServer;
14 bindClientConnect(server: TServer, callback: Function): any;
15 bindClientDisconnect?(client: TClient, callback: Function): any;
16 bindMessageHandlers(client: TClient, handlers: WsMessageHandler[], transform: (data: any) => Observable<any>): any;
17 close(server: TServer): any;
18}