Implementing the Client-Side Notification and Solicit-Response Endpoints
Three extra classes are generated on the client side to support the notification pattern.
*WeatherSummaryNotificationSkeleton: The skeleton that receives and handles the message, in this case on the client. Dispatches to the notification operation methods in the notification implementation.
*WeatherSummaryNotificationBase: The base class for the client-side notification implementation. Similar to WeatherSummaryBase, except on the client side.
*WeatherSummaryNotificationImp: Derives from WeatherSummarytNotificationBase. A sample implementation that you may use and edit.
In addition, three client-specific configuration files are used:
The code below is from WeatherSummaryNotificationImp.cpp. It shows both the weatherNotification() method that handles the notification message initiated by the server, and the endpoint implementation representing the client response to the server’s verifySubscription() solicit-response message.
WeatherSummaryNotificationImp) //1
WeatherSummaryNotificationImp::weatherNotification(rwsf::CallInfo& callInfo,
const wsx::WeatherSummary& weatherData_in) //2
std::cout << "WEATHER UPDATE RECEIVED: " << std::endl
<< " zipcode = " << weatherData_in.getZipcode() << std::endl
<< " windSpeed = " << weatherData_in.getWindSpeed() << std::endl
<< " sky = " << weatherData_in.getSky() << std::endl
<< " temp = " << weatherData_in.getTemp() << std::endl
<< std::endl;
WeatherSummaryNotificationImp::verifySubscription(rwsf::CallInfo& callInfo) //3
return true;
//1 Registers the client notification implementation as a message handler.
//2 Prints out the data in the incoming notification message from the server.
//3 Responds true to the server’s verifySubscription message to indicate that the client is reachable from the server. This is the implementation of the solicit-response message endpoint.