OnixS C++ FIX Engine  4.12.0
API Documentation
Understanding Session States

During the FIX session lifetime, state changes occur. The OnixS::FIX::Session class exposes the OnixS::FIX::Session::state member to determine in which state it currently resides.

The following table describes all possible FIX session states that can occur during its lifetime, as well as what a specific state means for a session with a particular role.

State Description
Role == Acceptor Role == Initiator
Disconnected The session is disconnected.
LoginInProgress The session is waiting for the initial Logon message. The initial Logon message was sent, and the session is waiting for the acknowledgment Logon message.
Active The session is fully established (after the successful Logon exchange).
Reconnecting N/A (only session-initiator can be in this state). Session-initiator is trying to restore the telecommunication link.
LogoutInProgress The initial Logout message was sent, and the session is waiting for the acknowledgment Logout message.

Initiator Session State Diagram

session-state-initiator.png

Acceptor Session State Diagram

session-state-acceptor.png

Tracking Session State Change

OnixS::FIX::ISessionListener class exposes OnixS::FIX::ISessionListener::onStateChange virtual function for its users.

Overriding this member in descendant classes provides an ability to be notified about all changes in state of a particular session.

Example

class SessionStateListener : public ISessionListener
{
public:
void onStateChange(SessionState::Enum newState, SessionState::Enum prevState, Session*) ONIXS_FIXENGINE_OVERRIDE
{
std::clog
<< "\nSession's state is changed"
<< ". Previous state was " << SessionState::toString(prevState)
<< ", new state is " << SessionState::toString(newState)
<< std::endl;
}
};