Constructor
Polling client options
Asynchronous initializer.
Returns a promise to call the specified polling function using the interval and timeout specified in the polling options.
A promise to call the specified polling function using the interval and timeout specified in the polling options.
Asynchronously constructs and initializes a new instance of a concrete subclass with the optional options.
An options object providing initialization params to the async constructor.
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 {
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});