Handling Session Events

Session events provide information about the state of a client connection to the event broker, including connection establishment, disconnection, and error conditions. Properly handling these events allows your application to respond appropriately to changes in connection status and maintain robust messaging operations.

Solace C API

When a session is created, the application must provide a session event callback (solClient_session_eventCallbackInfoFunc_t), along with an optional pointer to client data. This callback routine is invoked for event broker events that occur for the session, such as connection problems, or publish or subscription issues.

For a complete list of possible session events,see the Solace C API reference.

Solace Messaging API for JavaScript and Node.js

When a session is created, the application must provide session event listeners for each important session events that are invoked each time an event occurs over the session.

For a complete list of session events, see solace.SessionEventCode in the Solace JavaScript API and Solace Node.js API reference.

Related Samples

  • For an example of how to configure a session event callback for the Solace C API, see the common.c sample file.
  • For an example of how to configure session event listeners for the Solace JavaScript API and Solace Node.js API, see the TopicSubscriber.js sample.