Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServerTCP

Hierarchy

Implements

Index

Constructors

constructor

  • new ServerTCP(options: TcpOptions["options"]): ServerTCP

Properties

Protected deserializer

deserializer: ConsumerDeserializer

Private Readonly host

host: string

Private isExplicitlyTerminated

isExplicitlyTerminated: boolean = false

Protected Readonly logger

logger: Logger = new Logger(Server.name)

Protected Readonly messageHandlers

messageHandlers: Map<string, MessageHandler<any, any, any>> = new Map<string, MessageHandler>()

Private Readonly options

options: TcpOptions["options"]

Private Readonly port

port: number

Private retryAttemptsCount

retryAttemptsCount: number = 0

Protected serializer

serializer: ConsumerSerializer

Private server

server: NetSocket

Readonly transportId

transportId: TCP = Transport.TCP

Methods

addHandler

  • addHandler(pattern: any, callback: MessageHandler, isEventHandler?: boolean): void

bindHandler

  • bindHandler(socket: Socket): void

close

  • close(): void

getHandlerByPattern

getHandlers

getOptionsProp

  • getOptionsProp<T, K>(obj: T, prop: K, defaultValue?: T[K]): T[K]

Protected getRouteFromPattern

  • getRouteFromPattern(pattern: string): string

Private getSocketInstance

handleClose

  • handleClose(): undefined | number | Timer

Protected handleError

  • handleError(error: string): void

handleEvent

handleMessage

  • handleMessage(socket: JsonSocket, rawMessage: unknown): Promise<any>

Private init

  • init(): void

Protected initializeDeserializer

  • initializeDeserializer(options: ClientOptions["options"]): void

Protected initializeSerializer

  • initializeSerializer(options: ClientOptions["options"]): void

listen

  • listen(callback: () => void): void

Protected loadPackage

  • loadPackage<T>(name: string, ctx: string, loader?: Function): T

Protected normalizePattern

  • normalizePattern(pattern: MsPattern): string

send

  • send(stream$: Observable<any>, respond: (data: WritePacket) => void): Subscription

transformToObservable

  • transformToObservable<T>(resultOrDeferred: any): Observable<T>

Generated using TypeDoc