You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support using the disconnected callback to refresh the token or JWT used to authenticate to allow reconnecting without the need to create a new connection and subscribe to all the topic again.
Something like this (working snippet using the V1 client):
opts.DisconnectedEventHandler += (sender, args) =>
{
args.Conn.Opts.Token = RefreshToken();
};
opts.Token = GetToken();
using IConnection c = new ConnectionFactory().CreateConnection(opts);
Use case
We have a long running application that subscribes to several NATS topics.
The authentication in our scenario is made using tokens, with expiration.
In order to allow the reconnect of the same connection upon disconnect, we need to provide a valid token, so it might need to be refreshed due to expiry date.
This proposal would void the need to create a new connection and re-subscribe to all topics,
Contribution
Yes, I'm glad to help (might lack some context on the internals though)
The text was updated successfully, but these errors were encountered:
Proposed change
Support using the disconnected callback to refresh the token or JWT used to authenticate to allow reconnecting without the need to create a new connection and subscribe to all the topic again.
Something like this (working snippet using the V1 client):
Use case
We have a long running application that subscribes to several NATS topics.
The authentication in our scenario is made using tokens, with expiration.
In order to allow the reconnect of the same connection upon disconnect, we need to provide a valid token, so it might need to be refreshed due to expiry date.
This proposal would void the need to create a new connection and re-subscribe to all topics,
Contribution
Yes, I'm glad to help (might lack some context on the internals though)
The text was updated successfully, but these errors were encountered: