Adding _sessionNotify to server side helloWorld example
The _sessionNotify function has been added to the HelloWorldServer
implemenation. This code shows how to handle events from the stack on the
server implementation side.
Change-Id: Ic3089b2a3b5b9f96f6ef353a4461f04e7c6e844a
git-svn-id: https://svn.apache.org/repos/asf/etch/trunk@1578906 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/examples/helloworld/cpp/src/main/include/ImplHelloWorldServer.h b/examples/helloworld/cpp/src/main/include/ImplHelloWorldServer.h
index aaae8e0..b9344dd 100644
--- a/examples/helloworld/cpp/src/main/include/ImplHelloWorldServer.h
+++ b/examples/helloworld/cpp/src/main/include/ImplHelloWorldServer.h
@@ -39,6 +39,19 @@
// messages from the mClient.
say_helloAsyncResultPtr say_hello(HelloWorld::userPtr to_whom);
+ virtual status_t _sessionNotify(capu::SmartPointer<EtchObject> event ) {
+ if (event->getObjectType() == EtchString::TYPE()) {
+ capu::SmartPointer<EtchString> myEvent = capu::smartpointer_cast<EtchString>(event);
+ if (myEvent->equals(&EtchSession::DOWN())) {
+ //client has closed session
+ }
+ if (myEvent->equals(&EtchSession::UP())) {
+ //session to client has been established
+ }
+ }
+ return ETCH_OK;
+ }
+
};
}