Streaming API
ts-force
support streaming and platform events, via the Streaming
class.
Push Topics (Steaming API)
The Streaming
class has two "subscribe" methods for listening to push topics:
subscribeToTopic
: Provides raw data. Does NOT map resulting data to an generated class SObjectsubscribeToTopicMapped
: Maps returned data to a generated class SObject (type provided in first parameter)
Platform Events
Platform events work similar to PushTopics
but instead you listen using subscribeToEvent<T>
.
Automatic mapping to a Platform event generated object is not yet supported (coming soon), but in the meantime you can define the resulting type via the <T>
parameterized interface.
Disconnect / Unsubscribing
It is important to call disconnect()
or unsubscribe
with you are done:
Using with Node
We are using the to manage subscriptions. In order for this library to run on node, you must polyfill it.
npm install -s cometd-nodejs-client
Before you attempt to connect your client, run:
require('cometd-nodejs-client').adapt();
Last updated
Was this helpful?