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

Protocol: standartize error codes, disconnect codes, client and subscription statuses throughout connectors #149

Closed
FZambia opened this issue Aug 29, 2020 · 6 comments · Fixed by #234

Comments

@FZambia
Copy link
Member

FZambia commented Aug 29, 2020

At the moment we give access to string reason, but not to disconnect code. I suppose we should expose access to the code too.

@FZambia FZambia added this to the v1.0.0 milestone Aug 29, 2020
@FZambia
Copy link
Member Author

FZambia commented Nov 15, 2020

There are cases when client disconnected due to network conditions, timeout, etc. In these cases, there is no disconnect code from a server available. The simplest solution is providing 0 as code in disconnect context. But I suppose it may be better to standardize client-side codes for these situations:

  • CleanDisconnect: 0 false
  • TransportConnectError: 1 true
  • TransportWriteError: 2 true
  • TransportReadError: 3 true
  • TransportClosed: 4 true
  • ConnectFailed: 5 false
  • RefreshFailed: 6 false
  • Unauthorized: 7 false
  • Unrecoverable: 8 false
  • ConnectTimeout: 9 true
  • SubscribeTimeout: 10 true
  • NoPing: 11 true
  • Slow Client: 12 true
  • UnsubscribeError: 13 true

All client-side disconnects except clean disconnect result in a reconnect.

P.S. A good thing would be also think about client-side error codes.

@FZambia
Copy link
Member Author

FZambia commented Feb 7, 2021

Possible client errors and codes:

  • TransportConnectError = 0
  • Timeout = 1
  • TransportWriteError = 2
  • ClientDisconnected = 3
  • SubscriptionUnsubscribed = 5
  • SubscriptionClosed =

@FZambia FZambia changed the title Access to Disconnect code throughout client libraries Protocol: Access to Disconnect code throughout client libraries May 3, 2021
@FZambia
Copy link
Member Author

FZambia commented Oct 27, 2021

Also, for the future would be great to standardize client connector statuses. One possible option is having:

  • DISCONNECTED
  • CONNECTING
  • CONNECTED
  • CLOSED

Relates centrifugal/centrifuge-swift#27

@FZambia
Copy link
Member Author

FZambia commented Nov 12, 2021

And subscription statuses (not actual - see UPD below):

  • UNSUBSCRIBED
  • SUBSCRIBING
  • SUBSCRIBED
  • ERROR
  • CLOSED

UPD: things evolved here a bit, current plan is to have:

  • UNSUBSCRIBED
  • SUBSCRIBING
  • SUBSCRIBED

@FZambia FZambia changed the title Protocol: Access to Disconnect code throughout client libraries Protocol: standartize error codes, disconnect codes, client and subscription statuses throughout connectors Nov 12, 2021
@FZambia
Copy link
Member Author

FZambia commented Dec 17, 2021

Also, looking for a way to avoid using JSON string as reason in disconnects. I think we may somehow use code to indicate whether or not client should reconnect (odd/even?). And send plain text reason. Not sure how to do this in backwards compatible way though.

Done in #221

@FZambia
Copy link
Member Author

FZambia commented Apr 30, 2022

If someone follows this issue – the current draft of standartized client API is in Centrifugo v4 WIP docs:

Client API v2

Any feedback is appreciated – this is the future of Centrifuge and Centrifugo.

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

Successfully merging a pull request may close this issue.

1 participant