Restart subscriptions after token refresh
In case the connection got lost and the client reconnected again, there is a possibility that the auth token is expired. This will lead to the subscription to fail due to being unauthorized. This, however, does not close the connection and the heartbeat messages are still being sent and received. Thus, after refreshing the token, the connection is still alive but not authorized, which is the same as not having the connection open.
This commit is contained in:
@@ -275,6 +275,11 @@ export class GraphQLClient extends BaseClient<
|
||||
|
||||
return fromPromise(BaseClient.refreshAccessToken(this.handleRefreshToken))
|
||||
.filter(Boolean)
|
||||
.map((result) => {
|
||||
this.restartAllSubscriptions();
|
||||
|
||||
return result;
|
||||
})
|
||||
.flatMap(() => forward(operation));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user