Setting session callbacks
When your application successfully connects to a session one or more user-defined callbacks can optionally be invoked. There are several ways to invoke callbacks upon connection to a session:
Execute
SessionHandlerFactory.connectCb() and specify the callback that you want to invoke upon session connection.
If you add one or more connected callbacks and then execute SessionHandler.connectCb(), this invokes the callback specified in the connectCb() action and ignores any callbacks you added with the addConnectedCallback() action. If you then call SessionHandler.connect(), the callbacks you previously added with addConnectedCallback() are used.