Subscription Sequencing

Subscriptions can be either pull or push model. The pull model is essentially a polling model in which the client requests new events; in the push mode, the server delivers events as they occur.

In all models, the subscription starts with a client application (that is, the higher layer above the protocol client) calling the EvtRpcRegisterRemoteSubscription (section method to get a CONTEXT_HANDLE_REMOTE_SUBSCRIPTION handle. The subscription ends when that handle is closed by using the EvtRpcClose (section method.

In between these calls, the two models vary. All methods used in the two models use the CONTEXT_HANDLE_REMOTE_SUBSCRIPTION handle.

In the pull model, the client loops by using the EvtRpcRemoteSubscriptionNext (section method to get events. Optionally, the client can use the EvtRpcRemoteSubscriptionWaitAsync (section method to delay calling the EvtRpcRemoteSubscriptionNext (section method until events are ready. The server completes the EvtRpcRemoteSubscriptionWaitAsync (section method call when new events are ready.

In the push model, the client loops by using the EvtRpcRemoteSubscriptionNextAsync (section method to get events. The call MUST be completed by the server when a new event is ready.

Note that there is also a CONTEXT_HANDLE_OPERATION_CONTROL handle returned by the EvtRpcRegisterRemoteSubscription (section method. The sequencing and use of these handles are specified in section

The application ends the subscription by passing the CONTEXT_HANDLE_REMOTE_SUBSCRIPTION handle to the EvtRpcClose (section method.