getEvent Method

Get an IModelHubGlobalEvent from the GlobalEventSubscription. You can use long polling timeout, to have requests return when events are available (or request times out), rather than returning immediately when no events are found.

getEvent(requestContext: ClientRequestContext, sasToken: string, baseAddress: string, subscriptionId: string, timeout?: number, getOperation: GetEventOperationType = GetEventOperationType.Destructive): Promise<IModelHubGlobalEvent | undefined>

throws IModelHubClientError with IModelHubStatus.UndefinedArgumentError or IModelHubStatus.InvalidArgumentError if one of the arguments is undefined or has an invalid value.

throws ResponseError if request has failed.

Parameter Type Description
requestContext ClientRequestContext The client request context
sasToken string SAS Token used to authenticate. See GlobalEventSAS.sasToken.
baseAddress string Address for the events. See GlobalEventSAS.baseAddress.
subscriptionId string Id of the subscription to the topic. See GlobalEventSubscription.
timeout number Optional timeout duration in seconds for request, when using long polling.
getOperation GetEventOperationType  

Returns - IModelHubGlobalEvent if it exists, undefined otherwise.

Defined in

Last Updated: 08 January, 2020