Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Client handles connection, authentication and invocation of methods of an RPC service

export
class

Client

Hierarchy

  • Client

Index

Properties

bearerToken

bearerToken: string = ""

Bearer token to use

type

{string}

memberof

Client

Private opts

opts: ConnectOptions

Connection options

type

{ConnectOptions}

memberof

Client

Methods

call

  • call(method: string, params: any, cb: function): void
  • Call an RPC method

    memberof

    Client

    Parameters

    • method: string

      The method to be called

    • params: any

      The parameter to pass to the method

    • cb: function

      Callback to be invoked on success/failure

        • (err: any, result: any): void
        • Parameters

          • err: any
          • result: any

          Returns void

    Returns void

Private makeRequest

  • makeRequest(method: string, id: string, params: any): object
  • Create JSON-RPC 2.0 request

    memberof

    Client

    Parameters

    • method: string
    • id: string
    • params: any

    Returns object

    • id: string
    • jsonrpc: string
    • method: string
    • params: any

Static fromOptions

  • fromOptions(opts: ConnectOptions): Client
  • Create a Client from the given options

    static
    memberof

    Client

    Parameters

    • opts: ConnectOptions

    Returns Client