Session Messages
Session-level messages manage the connection lifecycle between client and server, ensuring message sequence integrity and heartbeat maintenance.
Implementation Notes
Session Management
- Require Logon/Logout exchange and consistent sequence numbers.
- Start heartbeat monitoring right after logon; persist state to allow reconnect recovery.
Error Handling
- Send
Rejecton protocol violations. - Use heartbeat checks to detect failures and close sessions cleanly to avoid data loss.
Security
- Protect credentials and use unique, unpredictable session IDs.
- Ensure message integrity with correct sequencing and enable FIX encryption if needed.
Administrative Messages
Session Flow Diagram
Session Establishment Flow:
- Initiator sends Logon message with proposed heartbeat interval and credentials
- Acceptor validates credentials and responds with Logon acknowledgment
- Both parties may begin message exchange after successful logon sequence
- Heartbeat monitoring begins immediately using the agreed interval
Standard Header
All FIX messages include a standard header containing essential routing and sequencing information. The header must appear at the beginning of every message and contains the following fields in the specified order:
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| 8 | BeginString | Y | String | Protocol version identifier. Must be set to "FIX.4.4" and appear as the first field in every message. |
| 9 | BodyLength | Y | Int | Length of the message body in bytes, calculated from the beginning of tag 35 to the end of the last field before the checksum. Must be the second field in the message. |
| 35 | MessageType | Y | String | Identifies the message type and determines the structure of the message body. Must be the third field in the message. |
| 34 | MsgSeqNum | Y | Int | Sequential message number assigned by the sender. Used for message ordering and gap detection. Sequence numbers are maintained per session and must increment by one for each new message. |
| 49 | SenderCompID | Y | String | Unique identifier for the message sender. This value is assigned during session setup and must remain consistent throughout the session lifetime. |
| 52 | SendingTime | Y | String | Timestamp indicating when the message was created and sent. Format: YYYYMMDD-HH:MM:SS or YYYYMMDD-HH:MM:SS.sss (with milliseconds). All times must be in UTC. |
| 56 | TargetCompID | Y | String | Unique identifier for the intended message recipient. This value is assigned during session setup and ensures proper message delivery. |
Logon (MsgType=A)
The Logon message establishes and authenticates a FIX session connection. It must be the first message transmitted by the session initiator and requires acknowledgment from the acceptor before normal message flow can begin.
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = A | ||||
| 98 | EncryptMethod | Y | Int | Specifies the message encryption method. Only clear-text transmission is supported, requiring this field to be set to 0 (None). |
| 108 | HeartBtInt | Y | Int | Heartbeat interval in seconds, representing the maximum time between messages before a heartbeat is required by client. Both parties must use the same interval, which should not exceed 60 seconds. The initiator proposes this value and the acceptor confirms by echoing it back. |
| 141 | ResetSeqNumFlag | C | Boolean | This field is mandatory for market data sessions and optional for trade sessions. Used to synchronize sequence numbering at session start. Must be set to "Y" for quoting sessions. When set to "Y", indicates that sequence numbers should be reset to 1 for both parties. |
| 554 | Password | Y | String | Authentication credential required for session establishment. This value is securely provided during account setup and must be included in every logon attempt for security verification. |
Heartbeat (MsgType=0)
Heartbeat messages maintain session connectivity during periods of inactivity and verify the communication link status. They are automatically generated when no other messages are transmitted within the heartbeat interval.
Additional Heartbeat requirement:
Client should send a Heartbeat (35=0) message to ACY Connect at least every 30 seconds, else the session may be disconnected.
Heartbeat Behavior
- Auto-generates if no other messages are sent within the interval.
- Resets the timer whenever any message is received.
- Must be sent at least every 30 seconds when idle to avoid disconnection.
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = 0 | ||||
| 112 | TestReqID | N | String | Echo field used when the heartbeat is sent in response to a Test Request message. When present, must contain the exact value from the corresponding Test Request to confirm proper message processing. |
Test Request (MsgType=1)
Test Request messages verify bidirectional communication and prompt an immediate Heartbeat response. They are used to detect communication failures and ensure session connectivity.
Usage Guidelines
- Send to verify connectivity.
- Expect a Heartbeat reply with the same TestReqID.
- Allow for normal network delay before timing out.
- Useful for spotting and clearing communication gaps.
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = 1 | ||||
| 112 | TestReqID | Y | String | Unique identifier for this test request. The recipient must echo this exact value in the responding Heartbeat message to confirm proper bidirectional communication. Recommended to use timestamp-based values for uniqueness. |
Reject (MsgType=3)
Reject messages indicate that a received message could not be processed due to session-level errors such as invalid format, unsupported message types, or protocol violations.
Rejection Handling:
- Session-level rejects indicate protocol or format errors
- Distinguished from business-level rejects which use application-specific messages
- Rejected messages are not re-queued automatically
- Sender should investigate and correct the issue before retransmission
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = 3 | ||||
| 371 | RefTagID | N | Int | Identifies the specific field tag that caused the rejection when the error is field-specific. Helps pinpoint formatting or validation issues. |
| 372 | RefMsgType | N | String | Message type of the rejected message. Useful for identifying unsupported or malformed message types. |
| 373 | SessionRejectReason | N | Int | Standardized code indicating the category of rejection (e.g., invalid tag number, required tag missing, tag not defined for message type). |
| 45 | RefSeqNum | Y | Int | Sequence number of the message being rejected. Essential for identifying which specific message encountered processing errors. |
| 58 | Text | N | String | Human-readable description of the rejection reason. Provides additional context beyond the standardized reason codes for troubleshooting purposes. |
Logout (MsgType=5)
Logout messages gracefully terminate FIX sessions, allowing both parties to close connections in an orderly fashion and preserve session state information.
Logout Process
- Either side may start a logout.
- The peer replies with a Logout message.
- Close the connection once the exchange finishes.
- Preserve session state for future reconnection.
- Keep sequence numbers unless a later logon requests a reset.
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = 5 | ||||
| 35 | MsgType | Y | String | Must be set to "5" to identify this as a Logout message. This ensures proper session termination processing. |
| 58 | Text | N | String | Optional reason for session termination (e.g., "Normal shutdown", "System maintenance"). Provides context for the logout and aids in operational monitoring. |
Business Message Reject (35=j)
The Business Message Reject (j) message can reject an application-level message which fulfills session-level rules and cannot be rejected via any other means. Note if the message fails a session-level rule (e.g. body length is incorrect), a session-level Reject (3) message should be issued.
Scenarios which receives Business Message Reject:
- Message passes FIX session-layer validation but violates business rules
- Unsupported message type received by the application
- Conditionally required business fields are missing
- Business authorization failures occur
- No specific reject message exists for the particular business case
BusinessRejectReason (380)
- 0 = Other
- 1 = Unknown ID
- 2 = Unknown Security
- 3 = Unsupported Message Type (receive a valid, but unsupported MsgType (35))
- 4 = Application not available
- 5 = Conditionally Required Field Missing
- 6 = Not Authorized
- 7 = DeliverTo firm not available at this time
- 18 = Invalid price increment
| Tag | Field Name | Required | Type | Description |
|---|---|---|---|---|
| <Standard Header> Y - MsgType <35> = j | ||||
| 45 | RefSeqNum | N | Int | Sequence number of the message being rejected. Used to identify which business message encountered processing errors and ensure proper correlation with the original request. |
| 372 | RefMsgType | Y | String | Message type of the message being rejected. Essential for identifying which type of business logic validation failed and enabling appropriate error handling by the sender. |
| 379 | BusinessRejectRefID | N | String | Reference identifier from the rejected message that helps locate the specific business entity or transaction. The value depends on the message type being rejected (e.g., ClOrdID for orders, MDReqID for market data requests). |
| 380 | BusinessRejectReason | Y | Int | Standardized code indicating the reason of business rejection. |
| 58 | Text | N | String | Explanation of the rejection reason. Should provide specific details about the business rule violation to facilitate problem resolution and system debugging. |