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.

const options: PollingClient.Options = {
async poll(): Promise<StatusResult> {
return Promise.resolve({ completed: true, payload: 'Hello World' });
},
frequency: Duration.milliseconds(10),
timeout: Duration.minutes(1)
};
const client = await PollingClient.create(options);
const pollResult = await client.subscribe();
console.log(`pollResult: ${pollResult}`);

Hierarchy

Methods

Methods

  • Returns a promise to call the specified polling function using the interval and timeout specified in the polling options.

    Type Parameters

    • T = AnyJson

    Returns Promise<T>