Skip to content

Commit 2347cc9

Browse files
authored
fix: websocket connection drops on flaky WiFi networks (#88)
1 parent 777c5ce commit 2347cc9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/aioharmony/hubconnector_websocket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# TODO: Clean up code styling
3434

3535
_WS_TIMEOUT = ClientWSTimeout(ws_receive=None, ws_close=DEFAULT_TIMEOUT)
36+
_WS_HEARTBEAT = 30 # Send ping every 30s, expect pong within 15s
3637

3738

3839
# pylint: disable=too-many-instance-attributes
@@ -155,7 +156,7 @@ async def hub_connect(self, is_reconnect: bool = False) -> bool:
155156
self._websocket = await self._session.ws_connect(
156157
f"ws://{self._ip_address}:{DEFAULT_HUB_PORT}/?domain={self._domain}&hubId={self._remote_id}",
157158
timeout=_WS_TIMEOUT, # close timeout
158-
heartbeat=10,
159+
heartbeat=_WS_HEARTBEAT,
159160
)
160161
except (
161162
aiohttp.ServerTimeoutError,

0 commit comments

Comments
 (0)