• Public
  • Public/Protected
  • All

Class Communicator<Provider>

The basic communicator.

The Communicator is an abstract class taking full charge of network communication. Protocolized communicators like WebConnector are realized by extending this Communicator class.

You want to make your own communicator using special protocol, extends this Communicator class. After the extending, implement your special communicator by overriding those methods.


Jeongho Nam http://samchon.org

Type parameters

  • Provider

    Type of features provided for remote system.




Protected constructor


Protected destructor

  • destructor(error?: Error): Promise<void>
  • Destory the communicator.

    A destory function must be called when the network communication has been closed. It would destroy all function calls in the remote system (by Driver<Controller>), which are not returned yet.

    The error instance would be thrown to those function calls. If the disconnection is abnormal, then write the detailed reason why into the error instance.


    • Optional error: Error

      An error instance to be thrown to the unreturned functions.

    Returns Promise<void>


  • getDriver<Controller, UseParametric>(): Driver<Controller, UseParametric>
  • Get Driver for RFC (Remote Function Call).

    The Controller is an interface who defines provided functions from the remote system. The Driver is an object who makes to call remote functions, defined in the Controller and provided by Provider in the remote system, possible.

    In other words, calling a functions in the Driver<Controller>, it means to call a matched function in the remote system's Provider object.

    • Controller: Definition only
    • Driver: Remote Function Call

    Type parameters

    • Controller: object

      An interface for provided features (functions & objects) from the remote system (Provider).

    • UseParametric: boolean

      Whether to convert type of function parameters to be compatible with their pritimive.

    Returns Driver<Controller, UseParametric>

    A Driver for the RFC.


  • getProvider(): Provider
  • Get current Provider.

    Get an object providing features (functions & objects) for remote system. The remote system would call the features (Provider) by using its Driver<Controller>.

    Returns Provider

    Current Provider object

Protected Abstract inspectReady

  • inspectReady(): Error | null


  • join(): Promise<void>
  • join(ms: number): Promise<boolean>
  • join(at: Date): Promise<boolean>
  • Join connection.

    Returns Promise<void>

  • Join connection or timeout.


    • ms: number

      The maximum milliseconds for joining.

    Returns Promise<boolean>

    Whether awaken by disconnection or timeout.

  • Join connection or time expiration.


    • at: Date

      The maximum time point to join.

    Returns Promise<boolean>

    Whether awaken by disconnection or time expiration.

Protected replyData

  • replyData(invoke: Invoke): void
  • Data Reply Function.

    A function should be called when data has come from the remote system.

    When you receive a message from the remote system, then parse the message with your special protocol and covert it to be an Invoke object. After the conversion, call this method.


    • invoke: Invoke

      Structured data converted by your special protocol.

    Returns void

Protected Abstract sendData

  • sendData(invoke: Invoke): void


  • setProvider(obj: Provider): void

Generated using TypeDoc