Class WebSocketInterceptor
-
- All Implemented Interfaces:
-
okhttp3.Interceptor
public final class WebSocketInterceptor implements InterceptorInterceptor for WebSocket request, it will add authorization header with token to the request.
-
-
Constructor Summary
Constructors Constructor Description WebSocketInterceptor(String destination, OAuth2TokenStore tokenStore, Function1<String, OAuth2Token> fetchToken)
-
Method Summary
Modifier and Type Method Description Responseintercept(Interceptor.Chain chain)-
-
Constructor Detail
-
WebSocketInterceptor
WebSocketInterceptor(String destination, OAuth2TokenStore tokenStore, Function1<String, OAuth2Token> fetchToken)
- Parameters:
destination- the optional destination name to fetch token for, it will be used to build the token url, like: {backendUrl}/mobileservices/{applicationId}/{destination}/oauthtokentokenStore- the token store to get and store token, it will be used to get token from store first before fetching new onefetchToken- the optional function to fetch new token, it will be called when there is no token in store or the token in store is expired, if not provided, it will use the default implementation to fetch token from server with the default token url
-
-
Method Detail
-
intercept
Response intercept(Interceptor.Chain chain)
-
-
-
-