class WsAdapter extends AbstractWsAdapter {
constructor(appOrHttpServer?: any)
protected logger: Logger
protected httpServersRegistry: Map<HttpServerRegistryKey, HttpServerRegistryEntry>
protected wsServersRegistry: Map<WsServerRegistryKey, WsServerRegistryEntry>
create(port: number, options?: Record<string, any> & { namespace?: string; server?: any; path?: string; })
bindMessageHandlers(client: any, handlers: MessageMappingProperties[], transform: (data: any) => Observable<any>)
bindMessageHandler(buffer: any, handlers: MessageMappingProperties[], transform: (data: any) => Observable<any>): Observable<any>
bindErrorHandler(server: any)
bindClientDisconnect(client: any, callback: Function)
dispose()
protected ensureHttpServerExists(port: number, httpServer: Server<typeof IncomingMessage, typeof ServerResponse> = http.createServer())
protected addWsServerToRegistry<T extends Record<'path', string> = any>(wsServer: T, port: number, path: string)
}
Constructor
constructor(appOrHttpServer?: any)
Parameters
Option |
Type |
Description |
appOrHttpServer
|
any |
Optional. Default is undefined .
|
|
Properties
Property |
Description |
protected logger: Logger
|
Read-only.
|
protected httpServersRegistry: Map<HttpServerRegistryKey, HttpServerRegistryEntry>
|
Read-only.
|
protected wsServersRegistry: Map<WsServerRegistryKey, WsServerRegistryEntry>
|
Read-only.
|
Methods
create()
|
create(port: number, options?: Record<string, any> & { namespace?: string; server?: any; path?: string; })
Parameters
Option |
Type |
Description |
port
|
number |
|
options
|
Record & { namespace?: string; server?: any; path?: string; } |
Optional. Default is undefined .
|
|
bindMessageHandlers()
|
bindMessageHandlers(client: any, handlers: MessageMappingProperties[], transform: (data: any) => Observable<any>)
Parameters
|
bindMessageHandler()
|
bindMessageHandler(buffer: any, handlers: MessageMappingProperties[], transform: (data: any) => Observable<any>): Observable<any>
Parameters
Returns
Observable<any>
|
bindErrorHandler()
|
bindErrorHandler(server: any)
Parameters
Option |
Type |
Description |
server
|
any |
|
|
bindClientDisconnect()
|
bindClientDisconnect(client: any, callback: Function)
Parameters
Option |
Type |
Description |
client
|
any |
|
callback
|
Function |
|
|
dispose()
|
dispose()
Parameters
There are no parameters.
|
ensureHttpServerExists()
|
protected ensureHttpServerExists(port: number, httpServer: Server<typeof IncomingMessage, typeof ServerResponse> = http.createServer())
Parameters
Option |
Type |
Description |
port
|
number |
|
httpServer
|
Server |
Optional. Default is http.createServer() .
|
|
addWsServerToRegistry()
|
protected addWsServerToRegistry<T extends Record<'path', string> = any>(wsServer: T, port: number, path: string)
Parameters
Option |
Type |
Description |
wsServer
|
T |
|
port
|
number |
|
path
|
string |
|
|