Available languages: [Python](https://databento.com/docs/api-live/basics/system-messages.python.md) · [C++](https://databento.com/docs/api-live/basics/system-messages.cpp.md) · [Rust](https://databento.com/docs/api-live/basics/system-messages.rust.md) · [Raw](https://databento.com/docs/api-live/basics/system-messages.raw.md)

Source: https://databento.com/docs/api-live/basics/system-messages


### System messages

Our live API uses a system record (`SystemMsg`) to indicate non-error information to clients.

One use is heartbeating, to ensure the TCP connection remains open and to help clients detect a connection issue.
A heartbeat will only be sent if no other data record was sent to the client during the heartbeat interval.
The interval between heartbeat messages can be configured with the `heartbeat_interval_s` parameter to [Live](https://databento.com/docs/api-live/client/live.md).
The `is_heartbeat()` method will return `True` if the record is a heartbeat.

The gateway sends an end-of-interval message (`END_OF_INTERVAL`) once it has published every record for one interval of an OHLCV, BBO, or CBBO schema.
Its `ts_event` is the exclusive end of that interval.
For OHLCV schemas, that is the bar's `ts_event` plus the bar interval, so an `ohlcv-1m` end-of-interval message with a `ts_event` of 14:31:00 follows the bars stamped 14:30:00.
For BBO and CBBO schemas, it equals the `ts_recv` of the records in the interval.
The gateway sends one end-of-interval message per schema and interval.

| Field | Type | Description |
| `msg` | str | The message from the gateway. |
| `code` | int | Describes the type of system message. See table below. |

#### System code variants

Corresponds with the `SystemCode` enum.

| Variant | `code` | Description |
| HEARTBEAT | `0` | A message sent in the absence of other records to indicate the connection remains open. |
| SUBSCRIPTION_ACK | `1` | An acknowledgement of a subscription request. |
| SLOW_READER_WARNING | `2` | The gateway has detected this session is falling behind real-time data. |
| REPLAY_COMPLETED | `3` | Indicates a replay subscription has caught up with real-time data. This message will be sent per schema. |
| END_OF_INTERVAL | `4` | Signals that all records for an interval-based schema have been published for the interval ending at `ts_event`. |
| UNSUBSCRIBE_ACK | `5` | An acknowledgement of an unsubscribe request. |
