Skip to content

When unsubscribe From SSE the _retryConnection method must stop #30

@soufianebenyaala

Description

@soufianebenyaala

The error you are encountering occurs because you are attempting to add events to a StreamController that has already been closed. This issue is happening because unsubscribeFromSSE() closes the _streamController, but the SSEClient continues to try to add events to it.

Steps to Resolve the Issue

Check if the StreamController is Closed Before Adding Events:
You can modify the code to check if the _streamController is closed before adding events. This will prevent the "Bad state: Cannot add new events after calling close" error.

Properly Handle the Stream Lifecycle:

Ensure that when you unsubscribe from SSE, no new events are being processed or added to the stream. After calling unsubscribeFromSSE(), you should stop any further attempts to subscribe to or retry the SSE connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions