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.
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.
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.