The FIX Session Layer: Logon, Heartbeat, Logout
Before a single order can be sent, two FIX endpoints have to agree they're talking to each other, stay agreeing for the whole day, and part ways cleanly, that bookkeeping is the session layer, separate from the orders and trades it carries.
Prerequisites: The FIX Protocol
FIX (Financial Information eXchange) messages come in two flavors that get bundled together but do very different jobs. Application messages carry the actual trading content, new orders, cancels, execution reports. Session messages exist purely to keep the connection between two counterparties alive and synchronized, and never touch a matching engine. The session layer is the plumbing that makes the application layer trustworthy.
The three messages that bookend every session
A FIX connection starts with a Logon message, where both sides confirm protocol version, exchange credentials, and session parameters like the heartbeat interval. Once logged on, both sides periodically send a Heartbeat message, a simple "I'm still here", at the agreed interval, say every 30 seconds, even if there's no trading activity to report. If one side doesn't hear a heartbeat (or any message) within roughly 1.2× the interval, it sends a Test Request, demanding an immediate reply; if that goes unanswered too, the connection is assumed dead and torn down. At the end of the day, or when a firm wants to disconnect cleanly, a Logout message is exchanged so both sides know the session ended deliberately rather than by network failure.
This matters because a silently dropped TCP connection looks identical to a slow network from the outside, without heartbeats, neither side would know whether the counterparty is just quiet or has actually vanished, and an order sent into a dead connection can sit unacknowledged with the sender unsure if it was received.
Why this is a separate layer at all
Keeping session management distinct from trading content means a firm can build (or buy) one FIX engine that handles logon, heartbeats, and reconnection generically, then plug in different order-entry logic per venue on top. It also means the two problems get solved independently: sequence numbers and message integrity (covered separately) live in the session layer, while things like order tags and execution report fields live in the application layer. A broken heartbeat is purely a connectivity problem to diagnose; a rejected order is purely a business-logic problem, the split makes troubleshooting far more tractable than if both were tangled into one message stream.
The FIX session layer, Logon, Heartbeat, Test Request, Logout, exists solely to keep two connected systems synchronized and to detect a dead connection quickly, entirely separate from the orders and fills the application layer carries on top of it.
If a FIX connection seems to "hang" with orders going unacknowledged, check the heartbeat interval and last-message timestamps before touching the order logic, a surprising fraction of production incidents are session-layer problems (a missed heartbeat, a clock skew) rather than anything wrong with the trading messages themselves.
Discussion
💡 Discussion rules
- Ask and answer about this concept. Off-topic gets removed.
- No homework dumps. Show what you tried first.
- Corrections are welcome. Cite a source when you claim an error.
Loading discussion…
Related concepts
- Sequence Numbers, Gap Fill And Resend Requests
- FIX Message Types And The Tags That Matter
- Session Failover And Warm Standby Gateways
- Binary Order Entry: Why Exchanges Left FIX
- Why Orders Get Rejected
- Cancel/Replace: What Actually Happens
- ClOrdID, OrigClOrdID And Order Identity
- Drop Copies And Independent Order State
Practice in interviews
Further reading
- FIX Trading Community, FIX 4.4 Specification, Volume 1