OnixS C++ FIX Engine 2.79.1.0
Understanding Session States

During the FIX session lifetime, state changes occur. OnixS::FIX::Session class exposes the OnixS::FIX::Session::getState 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.
LOGON_IN_PROGRESS 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.
LOGOUT_IN_PROGRESS The initial Logout message was sent and the session is waiting for the acknowledgment Logout message.

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 particular session.

Example

class SessionStateListener : public ISessionListener
{
public:

    virtual void Listener::onStateChange(
        Session::State newState, Session::State prevState, Session* sn)
    {           
                std::clog 
            << "\nSession's state is changed"
            << ". Previous state was " << Session::state2string(prevState) 
            << ", new state is " << Session::state2string(newState) 
            << std::endl;
        }
};