3.1.4.1 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 3.1.4.8) method to get a CONTEXT_HANDLE_REMOTE_SUBSCRIPTION handle. The subscription ends when that handle is closed by using the EvtRpcClose (section 3.1.4.33) 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 3.1.4.10) method to get events. Optionally, the client can use the EvtRpcRemoteSubscriptionWaitAsync (section 3.1.4.11) method to delay calling the EvtRpcRemoteSubscriptionNext (section 3.1.4.10) method until events are ready. The server completes the EvtRpcRemoteSubscriptionWaitAsync (section 3.1.4.11) method call when new events are ready.

In the push model, the client loops by using the EvtRpcRemoteSubscriptionNextAsync (section 3.1.4.9) 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 3.1.4.8) method. The sequencing and use of these handles are specified in section 3.1.4.6.

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