Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RpcServer

RPC Server class

Hierarchy

  • RpcServer

Index

Constructors

constructor

Properties

Private apikeyhash

apikeyhash: null | string

Private authentication

authentication: boolean

Private disabled

disabled: boolean

Private endpoints

endpoints: RpcEndpoint[] = []

Private envPrefix

envPrefix: string

Private host

host: string

Private httpServer

httpServer: Server = null

Private log

log: ILogger

Private port

port: number

Private requestLoggingFormat

requestLoggingFormat: string

Methods

addEndpoint

  • Add an RPC endpoint

    Parameters

    • path: string

      Path of the endpoint (e.g., '/execute')

    • module: any

      Module whose methods can be executed via the RPC endpoint

    • Optional options: IEndpointOptions

      RPC endpoint options

    Returns any

  • Add a custom RPC endpoint

    Parameters

    • rpcEndpoint: RpcEndpoint

      Instance of a class extending the 'RpcEndpoint' class

    Returns void

Private initialize

  • Initialize class attributes based on the provided command line arguments, environment variables and provided instance options

    Parameters

    Returns void

Protected registerRpcEndpoints

  • registerRpcEndpoints(server: any): void
  • Register all endpoints to the given server object

    Parameters

    • server: any

    Returns void

start

  • start(): Promise<Server>
  • Start the RPC server:

    • Register middlewares for each added RPC endpoint
    • Listen on specified host and port

    Returns Promise<Server>

stop

  • stop(): Promise<void>
  • Stop the RPC server (print an error message if the server is not running)

    Returns Promise<void>