diff --git a/CHANGELOG.md b/CHANGELOG.md index bb35842..88cccbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.35.1 - TBD + +#### Bug fixes +- Fixed an issue where heartbeat_interval_s was not being sent to the gateway + ## 0.35.0 - 2024-06-04 #### Enhancements diff --git a/databento/live/session.py b/databento/live/session.py index 79676bf..edd83c0 100644 --- a/databento/live/session.py +++ b/databento/live/session.py @@ -188,7 +188,7 @@ def __init__( ts_out: bool = False, heartbeat_interval_s: int | None = None, ): - super().__init__(api_key, dataset, ts_out) + super().__init__(api_key, dataset, ts_out, heartbeat_interval_s) self._dbn_queue = dbn_queue self._loop = loop diff --git a/tests/test_live_client.py b/tests/test_live_client.py index a5d61f6..c42c418 100644 --- a/tests/test_live_client.py +++ b/tests/test_live_client.py @@ -250,6 +250,39 @@ async def test_live_connect_auth( assert message.encoding == Encoding.DBN +async def test_live_connect_auth_with_heartbeat_interval( + mock_live_server: MockLiveServerInterface, + test_live_api_key: str, +) -> None: + """ + Test that setting `heartbeat_interval_s` on a Live client sends that field + to the gateway. + """ + # Arrange + live_client = client.Live( + key=test_live_api_key, + gateway=mock_live_server.host, + port=mock_live_server.port, + heartbeat_interval_s=10, + ) + + live_client.subscribe( + dataset=Dataset.GLBX_MDP3, + schema=Schema.MBO, + ) + + # Act + message = await mock_live_server.wait_for_message_of_type( + message_type=gateway.AuthenticationRequest, + ) + + # Assert + assert message.auth.endswith(live_client.key[-BUCKET_ID_LENGTH:]) + assert message.dataset == live_client.dataset + assert message.encoding == Encoding.DBN + assert message.heartbeat_interval_s == "10" + + async def test_live_connect_auth_two_clients( mock_live_server: MockLiveServerInterface, test_live_api_key: str,