fix: use getattr for ws.closed compatibility with websockets API

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hailin 2026-04-06 06:56:34 -07:00
parent 4eac803699
commit f479f156b9
1 changed files with 1 additions and 1 deletions

View File

@ -237,7 +237,7 @@ class Relay:
async def _on_speaker_frame(self, pcm_bytes):
"""Receive speaker PCM from bridge, resample, encode Opus, send to ESP32."""
if not self.ws or self.ws.closed:
if not self.ws or getattr(self.ws, 'closed', False):
return
try:
self._audio_out_count += 1