Create a listener for long polling events from an EventSubscription. When event is received from the subscription, every registered listener callback is called. This continuously waits for events until all created listeners for that subscriptionId are deleted. EventSAS token expirations are handled automatically, AccessToken expiration is handled by calling authenticationCallback to get a new token.
createListener(requestContext: ClientRequestContext, authenticationCallback: () => Promise<AccessToken>, subscriptionId: string, iModelId: GuidString, listener: (event: IModelHubEvent) => void): () => void
|requestContext||ClientRequestContext||The client request context|
|authenticationCallback||() => Promise<AccessToken>||Callback used to get AccessToken. Only the first registered authenticationCallback for this subscriptionId will be used.|
|subscriptionId||string||Id of EventSubscription.|
|iModelId||GuidString||Id of the iModel. See HubIModel.|
|listener||(event: IModelHubEvent) => void||Callback that is called when an IModelHubEvent is received.|
Returns - Function that deletes the created listener.
Last Updated: 08 January, 2020