Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSE thread will die silently #78

Open
joshmcculloch opened this issue Jan 21, 2024 · 1 comment
Open

SSE thread will die silently #78

joshmcculloch opened this issue Jan 21, 2024 · 1 comment

Comments

@joshmcculloch
Copy link
Contributor

Currently any exception in the SSEClient/Eventloop will result in the the thead exiting. In my testing I see the http.ReadTimeout exception when the connection to the server is dropped. There is no indication to the subscriber that new events are no longer getting through.

I'm happy to help with the fix, but I'm looking for some guidence on how to push the event through to the calling code and how the situation should be resolved.

To patch this for my appication I have just caught the exception, slept, and allowed a new connection to be established. Perhaps this was always the intention as there is already a while loop that causes the reconnect. Link to my change

@m29h
Copy link
Collaborator

m29h commented Jan 21, 2024

Thank you for looking into this.
Your solution looks fine for the situation where the client looses connection because of e.g. a temporary network issue.

However there is a second situation where the server loses the client due to e.g. an restart/update of the pocketbase server or server side timeout.

In this case the client would have to reissue the RealtimeService._submit_subscriptions() logic to the server so that the server gets again the actual subscriptions...

Currently you would end up in a kind of infinite reconnecting attempt loop if the server looses track of the client...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants