Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpProvider

Hierarchy

  • BaseProvider
    • HttpProvider

Index

Constructors

constructor

  • new HttpProvider(url: string, options?: any, fetcher?: any): HttpProvider
  • Parameters

    • url: string
    • Optional options: any
    • Optional fetcher: any

    Returns HttpProvider

Properties

Optional fetcher

fetcher: any

Optional options

options: any

Protected reqMiddleware

reqMiddleware: ReqMiddleware = new Map().set('*', [])

Protected resMiddleware

resMiddleware: ResMiddleware = new Map().set('*', [])

url

url: string

Methods

callbackHandler

  • callbackHandler(data: any, cb: any): any
  • function

    callbackHandler

    memberof

    HttpProvider.prototype

    Parameters

    • data: any

      from server

    • cb: any

      callback function

    Returns any

    • return object or callback function

endpointHandler

  • endpointHandler(obj: object, endpoint?: string): object
  • function

    endpointHandler

    memberof

    HttpProvider.prototype

    Parameters

    • obj: object

      payload object

    • Optional endpoint: string

      add the endpoint to payload object

    Returns object

    • assign a new object

Protected getMiddleware

  • getMiddleware(method: RPCMethod | string): [ReqMiddleware[], ResMiddleware[]]
  • Parameters

    • method: RPCMethod | string

    Returns [ReqMiddleware[], ResMiddleware[]]

optionsHandler

  • optionsHandler(obj: object): object
  • function

    optionsHandler

    memberof

    HttpProvider.prototype

    Parameters

    • obj: object

      options object

    Returns object

    • assign a new option object

payloadHandler

  • payloadHandler(payload: RPCRequestPayload<object>): object
  • function

    payloadHandler

    memberof

    HttpProvider.prototype

    Parameters

    • payload: RPCRequestPayload<object>

      payload object

    Returns object

    • to payload object

Protected pushMiddleware

  • pushMiddleware(fn: any, type: MiddlewareType, match: string | RPCMethod | RegExp): void
  • Parameters

    • fn: any
    • type: MiddlewareType
    • match: string | RPCMethod | RegExp

    Returns void

requestFunc

  • requestFunc(__namedParameters: { callback: any; endpoint: string; payload: RPCRequestPayload<object> }): Promise<any>
  • Parameters

    • __namedParameters: { callback: any; endpoint: string; payload: RPCRequestPayload<object> }
      • callback: any
      • endpoint: string
      • payload: RPCRequestPayload<object>

    Returns Promise<any>

send

  • send(payload: RPCRequestPayload<object>, callback?: any): Promise<any>
  • function

    send

    memberof

    HttpProvider.prototype

    Parameters

    • payload: RPCRequestPayload<object>

      payload object

    • Optional callback: any

      callback function

    Returns Promise<any>

    • RPC Response

sendServer

  • sendServer(endpoint: string, payload: RPCRequestPayload<object>, callback: any): Promise<any>
  • function

    sendServer

    memberof

    HttpProvider.prototype

    Parameters

    • endpoint: string

      endpoint to server

    • payload: RPCRequestPayload<object>

      payload object

    • callback: any

      callback function

    Returns Promise<any>

    • RPC Response

subscribe

  • subscribe(): void
  • Returns void

unsubscribe

  • unsubscribe(): void
  • Returns void

Object literals

middlewares

middlewares: object

request

request: object

use

  • use(fn: ReqMiddleware, match?: string | RPCMethod | RegExp): void
  • Parameters

    • fn: ReqMiddleware
    • Default value match: string | RPCMethod | RegExp = "*"

    Returns void

response

response: object

use

  • use(fn: ResMiddleware, match?: string | RPCMethod | RegExp): void
  • Parameters

    • fn: ResMiddleware
    • Default value match: string | RPCMethod | RegExp = "*"

    Returns void

Generated using TypeDoc