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:
schroda
2025-11-07 12:09:36 +01:00
parent 284c194ac3
commit 490ebb5bde

View File

@@ -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));
});
}