1 | import { Observable } from 'rxjs';
|
2 |
|
3 |
|
4 |
|
5 | export interface WsMessageHandler<T = string> {
|
6 | message: T;
|
7 | callback: (...args: any[]) => Observable<any> | Promise<any>;
|
8 | }
|
9 |
|
10 |
|
11 |
|
12 | export 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 | }
|