Options
All
  • Public
  • Public/Protected
  • All
Menu

This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement for Streaming when streaming topics are not available or when streaming handshakes are failing. Why wouldn't you want to use this? It can impact Salesforce API usage.

example

const options: PollingClient.Options = { async poll(): Promise { return Promise.resolve({ completed: true, payload: 'Hello World' }); }, frequency: new Time(10, TIME_UNIT.MILLISECONDS), timeout: new Time(1, TIME_UNIT.MINUTES) }; const client = await PollingClient.create(options); const pollResult = await client.subscribe(); console.log(pollResult: ${pollResult});

Hierarchy

  • AsyncOptionalCreatable<Options>
    • PollingClient

Index

Classes

Interfaces

Constructors

Properties

Methods

Constructors

constructor

  • Constructor

    see

    {@link AsyncCreatable.create}

    throws

    if options is undefined

    Parameters

    • Optional options: Options

      Polling client options

    Returns PollingClient

Properties

Protected logger

logger: Logger

Methods

init

  • init(): Promise<void>
  • Asynchronous initializer.

    async

    Returns Promise<void>

subscribe

  • subscribe(): Promise<AnyJson>
  • Returns a promise to call the specified polling function using the interval and timeout specified in the polling options.

    async

    Returns Promise<AnyJson>

    A promise to call the specified polling function using the interval and timeout specified in the polling options.

Static create

  • create<P, T>(this: object, options?: P): Promise<T>
  • Asynchronously constructs and initializes a new instance of a concrete subclass with the optional options.

    Type parameters

    • P

    • T: AsyncOptionalCreatable<P>

    Parameters

    • this: object
    • Optional options: P

      An options object providing initialization params to the async constructor.

    Returns Promise<T>