PreCache NetInjector Documentation Center : PreCache NetInjector Application Development

Basic Case, Subscription — C

   







Subscription closure

— associating the subscription with a closure


The Subscribe function sets value of the NULL closure originally defined as a string (in this case), My First Subscription.

PC_evn_subscribe_with_exp(p,
"Sample.Intro1",PC_NULL,
notify,strdup("My First Subscription"),
PC_NULL, &hSubscription);

We defined this final stage of content retrieval when we created our callback function:

notify(PC_evn_Notification notification, void* pClosure)

Upon notification delivery, the proxy passes the closure as the second argument of the notify function. The value of pClosure is defined by the Callback Function.

printf("Incoming notification for (%s):%s\n",
(char*)pClosure);

The output of the subscription is:

Incoming notification for My First Subscription: