From 5038ebf2054ffb4ed10cba354b63904b86baae82 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Tue, 23 Dec 2025 09:44:21 -0500 Subject: [PATCH] Clean up _receive_messages to use WebsocketService class --- src/pipecat/services/inworld/tts.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/pipecat/services/inworld/tts.py b/src/pipecat/services/inworld/tts.py index c140a2f61..a8b0c519d 100644 --- a/src/pipecat/services/inworld/tts.py +++ b/src/pipecat/services/inworld/tts.py @@ -666,12 +666,8 @@ class InworldTTSService(AudioContextWordTTSService): self._websocket = None await self._call_event_handler("on_disconnected") - async def _process_messages(self): - """Process incoming WebSocket messages from Inworld. - - Returns: - The messages. - """ + async def _receive_messages(self): + """Handle incoming WebSocket messages from Inworld.""" async for message in self._get_websocket(): try: msg = json.loads(message) @@ -761,18 +757,6 @@ class InworldTTSService(AudioContextWordTTSService): await self.remove_audio_context(ctx_id) await self.add_word_timestamps([("TTSStoppedFrame", 0), ("Reset", 0)]) - async def _receive_messages(self): - """Receive messages from the Inworld WebSocket TTS service with auto-reconnect. - - Returns: - The messages. - """ - while True: - await self._process_messages() - # Inworld may disconnect after period of inactivity, so we try to reconnect - logger.debug(f"{self} Inworld connection was disconnected, reconnecting") - await self._connect_websocket() - async def _send_context(self, context_id: str): """Send a context to the Inworld WebSocket TTS service.