Trying to work out how to refresh the authorization sent in the AppSyncWsProtocol protocol constructor.
fun provideAuthorizedWebSocketNetworkTransport(
okHttpClientAppSync: OkHttpClient.Builder,
credentialsStore: CredentialsStore,
): WebSocketNetworkTransport {
return WebSocketNetworkTransport.Builder()
.serverUrl(getWebSocketServerUrl())
.protocol(AppSyncWsProtocol.Factory(authorization = getAuthorizationMap(credentialsStore)))
.webSocketEngine(DefaultWebSocketEngine(okHttpClientAppSync.build()))
.build()
}
If this protocol was built before the credentials have been received or the auth token used in the startOperation
has been revoked. What is the recommended method of resetting authentication used in the AppSyncWsProtocol
?
The Apollo documentation seem to recommend closing and reopening the connection via an exception. This doesn’t appear to re-set the protocol used.
Apollo 2 provided the ability of a custom serialiser to overwrite/append the payload of websocket requests which we previously relied on but I can’t seem to find something similar.