We're using Redis to implement login mechanism between 2 servers over a vpn.
So basically it's :
How we did it ?
At server1
side we do :
string RandomNum = Guid.NewGuid().Tostring("N");
sub.Subscribe("DO_LOGIN"+RandomNum,(channel,message)=>{ //listen to specific (!) response
...
});
sub.Publish("Do_LOGIN",{ ...data , RandomNum});
While server2
is already listening via :
sub.Subscribe("DO_LOGIN",(channel,message) =>
{
//read message values + extract RandomNum from the message
//check DB if user OK
sub.Publish("DO_LOGIN"+RandomNum, ...data);
});
So as you can see- for every login I generate a number and command and then listen to a new channel which is concatenation of "command"+RandomNum
But we feel that this is a wrong path to go. Because all of those temp subscriptions.
Question:
Is it possible to implement login mechanism without temp subscriptions ? (unless this is how it should be)
NB We're using StackExchange.Redis