-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Handle connection errors #56
Comments
@LamaMen hi, all other Centrifugo clients expose Disconnect event if the initial connect failed, but centrifuge-dart does not - it just tries to reconnect in the background. I think we should mimic this behaviour here too. Do I understand right that your question is about handling errors on initial connect to the server? |
Yes!)) |
Hi, I looked at what you changed and I have a couple of questions:
And one more question, is it possible to transfer these changes to the version of the library without support null safty (for example v0.5.1)? We use an old version of flutter sdk on our project (v1.22.6). |
The reason it's not exposed is that nobody asked about it and I had no use case for it personally. If you need it to be exposed describe your use case. In most cases you better listen to state changes using connect/disconnect events and update application state instead of checking for connected status before operations. But I may miss sth here since it's hard to have all possible apps/use cases in mind.
config.retry is mostly for changing reconnect time strategy, disconnect reason can be found from disconnect event, and you can log errors from errorStream to investigate the exact error happening. Disconnect reason does not have exact detailed error description, it acts more like enum with some predefined values why the connection state changed. There are some plans to standartize disconnects a bit throughout Centrifugo(e) ecosystem: tracked in centrifugal/centrifuge#149 - but cant give any ETAs for it. Maybe you will have better ideas on the more handy error/disconnect handling strategy – we can discuss this!
I won't backport this myself, but if you are interested in migrating some of the later added features into 0.5.x then I can help creating a 0.5.x branch, merge pr with backwards compatible changes into it and release. |
Hi, I'm sorry I didn't answer for so long. I would still ask for your help to make a backport. I just haven't done this yet)) |
Why is Centrifuge's websocket used for mobile app instead of PUSH? |
Hello. I'm trying to use a centrifuge to create a simple chat and can't think of a better way to handle connection errors (for example, the user has no internet or the server is not available). Is there any way to do this?
The text was updated successfully, but these errors were encountered: