centrifugal / centrifuge-java

General Java and Android client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket
MIT License
65 stars 33 forks source link

Add HTTP response code to ErrorEvent #69

Closed vyndor closed 12 months ago

vyndor commented 1 year ago

Description

Add HTTP response code to ErrorEvent. There is an alternative approach to this PR.

In my opinion it would be better to pass whole response to ErrorEvent, but it will expose okhttp in centrifuge API.

Why our project needs this

Our project needs an ability to change an endpoint in case of specific errors:

HTTP status codes currently does not exposed by centrifuge SDK, so we do not know when we need to change endpoint.

FZambia commented 1 year ago

@vyndor many thanks! Do you plan to change the endpoint by re-instantiating client? Or we need a method for that?

vyndor commented 12 months ago

@FZambia many thanks! Do you plan to change the endpoint by re-instantiating client? Or we need a method for that?

Yes, I create new instance of Client with new endpoint. Though it would be better to have an ability to change endpoint on the same instance of Client.