Closed matiasmarcodelpont closed 1 year ago
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.
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?