WebSocketAdapter


interface WebSocketAdapter<TServer = any, TClient = any, TOptions = any> {
  create(port: number, options?: TOptions): TServer
  bindClientConnect(server: TServer, callback: Function): any
  bindClientDisconnect(client: TClient, callback: Function)?: any
  bindMessageHandlers(client: TClient, handlers: WsMessageHandler<string>[], transform: (data: any) => Observable<any>): any
  close(server: TServer): any
}

Methods

create()


create(port: number, options?: TOptions): TServer

Parameters

Option Type Description
port number
options TOptions

Optional. Default is undefined.

Returns

TServer

bindClientConnect()


bindClientConnect(server: TServer, callback: Function): any

Parameters

Option Type Description
server TServer
callback Function

Returns

any

bindClientDisconnect()


bindClientDisconnect(client: TClient, callback: Function)?: any

Parameters

Option Type Description
client TClient
callback Function

Returns

any

bindMessageHandlers()


bindMessageHandlers(client: TClient, handlers: WsMessageHandler<string>[], transform: (data: any) => Observable<any>): any

Parameters

Option Type Description
client TClient
handlers WsMessageHandler[]
transform (data: any) => Observable

Returns

any

close()


close(server: TServer): any

Parameters

Option Type Description
server TServer

Returns

any