diff --git a/lib/core/services/streaming_helper.dart b/lib/core/services/streaming_helper.dart index c368c7d..0bee080 100644 --- a/lib/core/services/streaming_helper.dart +++ b/lib/core/services/streaming_helper.dart @@ -434,9 +434,6 @@ StreamSubscription attachUnifiedChunkedStreaming({ } } if (payload['done'] == true) { - try { - socketService?.offChatEvents(); - } catch (_) {} try { // ignore: unawaited_futures api?.sendChatCompleted( @@ -894,13 +891,7 @@ StreamSubscription attachUnifiedChunkedStreaming({ // Unregister from persistent service persistentService.unregisterStream(streamId); - // Stop socket events now that streaming finished only for SSE-driven streams - if (socketService != null && suppressSocketContent == true) { - try { - socketService.offChatEvents(); - } catch (_) {} - } - // Allow socket content again for future sessions + // Allow socket-delivered follow-ups/title updates after SSE completes suppressSocketContent = false; // If SSE-driven (no dynamic channel/background flow), finish now @@ -913,12 +904,8 @@ StreamSubscription attachUnifiedChunkedStreaming({ try { persistentService.unregisterStream(streamId); } catch (_) {} + suppressSocketContent = false; finishStreaming(); - if (socketService != null && suppressSocketContent == true) { - try { - socketService.offChatEvents(); - } catch (_) {} - } socketWatchdog?.stop(); }, );