GetAllSubscriptionInfos does not return subscriptions

Hi,
in my angular application users do a lot of CRUD operations. I’m using SSE to notify users about operations status.
To simplify the front-end I would avoid to notify the same user which has completed successfully the insert\update\delete operations.
To notify users I get all subscriptions and compare each subscription sessionId to current back-end sessionId if they differ then I notify the subscription. This is the code:

                List<SubscriptionInfo> subsInfo = ServerEvents.GetAllSubscriptionInfos();
                foreach (SubscriptionInfo info in subsInfo)
                {
                    if (info.SessionId != AppDatiSessione.Id)
                    {
                        var sub = ServerEvents.GetSubscriptionInfo(info.SubscriptionId);
                        if (sub != null)
                        {
                            ServerEvents.NotifySubscription(info.SubscriptionId, AIdEntita, ACanale);
                        }
                    }
                }

All work great when I use MemoryServerEvents, if I switch to RedisServerEvents the ServerEvents.GetAllSubscriptionInfos() does not return subscriptions but if I exec KEYS * on redis-cli I see the clients registered.

What I’m missing?

Does this return the channel you’re subscribers are registered to?

KEYS sse:channel:*

Then does return a list of ids?

SMEMBERS sse:channel:{channelName}

Replace {channelName} with the channel you’re subscribed to.

both yes, as you can see here:

127.0.0.1:6379> keys *
 1) "sse:channel:RichiestaPazienteDTO@6054"
 2) "sse:seq:anonUser"
 3) "sse:userid:-4"
 4) "sse:id:Pe0N4bS4LSAbsiSXuDQx"
 5) "sse:channel:RichiestaPazienteDTO@6052"
 6) "sse:id:6Judp7VYHDRei6sq9jSX"
 7) "sse:session:C54qbL5Dy6M7F7zjP5Yo"
 8) "sse:channel:RichiestaPazienteDTO@6053"
 9) "sse:channel:RichiestaPazienteDTO@6055"
10) "sse:channel:RichiestaPazienteDTO@6051"
11) "sse:userid:-5"
12) "sse:session:ZeY5h3HVVDaLzMB7YpX1"
13) "sse:ids"
14) "sse:channel:RichiestaPazienteDTO@6050"
127.0.0.1:6379> keys sse:channel:*
1) "sse:channel:RichiestaPazienteDTO@6054"
2) "sse:channel:RichiestaPazienteDTO@6052"
3) "sse:channel:RichiestaPazienteDTO@6053"
4) "sse:channel:RichiestaPazienteDTO@6055"
5) "sse:channel:RichiestaPazienteDTO@6051"
6) "sse:channel:RichiestaPazienteDTO@6050"
127.0.0.1:6379> smembers sse:channel:RichiestaPazienteDTO@6050
1) "6Judp7VYHDRei6sq9jSX"
2) "Pe0N4bS4LSAbsiSXuDQx"
127.0.0.1:6379>

Your channel is called RichiestaPazienteDTO@6050?

Either way that’s basically what GetAllSubscriptionInfos() does:

Except it also fetches the UserSession stored in:

var values redis.GetValues<SubscriptionInfo>(new[] {  
    "sse:id:6Judp7VYHDRei6sq9jSX",
    "sse:id:Pe0N4bS4LSAbsiSXuDQx" 
});

Does manually calling the above API return a List<SubscriptionInfo> ?

But I don’t see where the issue is as that’s all GetAllSubscriptionInfos() is doing, you can try copying and pasting the above implementation in your own code and debugging through it to see at which point it’s not returning the expected data.

this is the debug of the API

I see the var ids is always empty whilst smembers sse:channel in redis-cli shows the usersession

this happens for all the subscribed channels

I have not a deep knowledge of redis, maybe the ‘@’ in the channel name interferes somewhere?

Thanks, looks like the issue is with the double-formatting of the ChannelSet key. I’ve added a fix which is available from ServiceStack v5 which is now available on MyGet. Please review ServiceStack v5 changes before upgrading.