You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The WebSocket API currently only provides very generic error codes. For certain types of errors like authentication errors, it might be beneficial to have specific error codes that we can map to on our side. This allows for better control and handling of different actions based on the exact error.
Current Situation
Currently, the backend always closes the connection gracefully (with code 1000) and provides no further details about the error. This absence of specific error codes impedes handling different actions based on the exact error such as reloading on authentication errors/ token expiry.
Why do we need this? Who uses it, and when?
It would be particularly useful in debugging and handling specific errors on the client-side. For example, if the API throws an authentication error, the client-side can take specific actions such refreshing the page to initiate fresh token retrieval.
Proposed Implementation
We propose to have specific error codes for different types of errors. For example, authentication errors can have a unique error code. These error codes can fall within the range 4000-4999, as per the WebSocket specification.
The backend should be updated to throw these specific error codes whenever such an error occurs. On the client side, these error codes can be captured and appropriate action can be taken.
Contributing
I can help by doing more research.
I can help by implementing the feature after the proposal above is approved.
I can help by testing the feature before it's released.
Summary
The WebSocket API currently only provides very generic error codes. For certain types of errors like authentication errors, it might be beneficial to have specific error codes that we can map to on our side. This allows for better control and handling of different actions based on the exact error.
Current Situation
Currently, the backend always closes the connection gracefully (with code 1000) and provides no further details about the error. This absence of specific error codes impedes handling different actions based on the exact error such as reloading on authentication errors/ token expiry.
Why do we need this? Who uses it, and when?
It would be particularly useful in debugging and handling specific errors on the client-side. For example, if the API throws an authentication error, the client-side can take specific actions such refreshing the page to initiate fresh token retrieval.
Proposed Implementation
We propose to have specific error codes for different types of errors. For example, authentication errors can have a unique error code. These error codes can fall within the range 4000-4999, as per the WebSocket specification.
The backend should be updated to throw these specific error codes whenever such an error occurs. On the client side, these error codes can be captured and appropriate action can be taken.
Contributing
Code of Conduct
The text was updated successfully, but these errors were encountered: