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
My http client authenticates with the server using a bearer token sent on an Authentication header. I have implemented an interceptor and a retry policy to handle the logic when the token must be refreshed.
Now I want to use te same InterceptedClient to create a WebSocket with the same server. The request uses the same Authentication header and must be updated in the same manner.
Is this possible?
The text was updated successfully, but these errors were encountered:
I don't think it is possible to do so since HTTP (https://) and WebSocket (ws://) are two different protocols.
WebSocket is a framed and bidirectional protocol. On the contrary, to this, HTTP is a unidirectional protocol functioning above the TCP protocol.
WebSocket protocol is capable to support continual data transmission, it’s majorly used in real-time application development.
HTTP is stateless and is used for the development of RESTful and SOAP applications.
That said, this package is built on top of http which was not thought for handling websockets. I think your best approach might be to abstract the behavior for token usage to a separate class and use/reuse the same instance in both http and websocket calls or try to find an alternative and more robust package that handles both scenarios (sad but true 😞 )
My http client authenticates with the server using a bearer token sent on an Authentication header. I have implemented an interceptor and a retry policy to handle the logic when the token must be refreshed.
Now I want to use te same InterceptedClient to create a WebSocket with the same server. The request uses the same Authentication header and must be updated in the same manner.
Is this possible?
The text was updated successfully, but these errors were encountered: