SSE stop working with Redis backend

Hi,

I am trying to get to the bottom of why server events just stop working for all clients after a random amount of time. All services are on Azure; web app & Azure Redis.

I have tracked through the SS code and now understand how Redis server events now work, and it appears that the pub-sub mechanism (of Redis, not ServiceStack) stops working; when I independently subscribe to “notify.channel.[channel]” in the redis-cli no messages are being broadcast when ServerEvents.NotifyChannel is being called.

Unless I’m mistaken, this must be something with MSs Redis implementation, but I’m wondering if there is there anything I can do from SS code? Specifically, what does RedisPubSubServer.WaitBeforeNextRestart do?

G

The WaitBeforeNextRestart is for pausing in-between restarts of the pub/sub subscription message loop, i.e. if there was a connection error with the redis-server.

You can try restarting the underlying RedisPubSub server which will force it to re-connect to the pub/sub subscription, e.g:

var redisEvents = (RedisServerEvents)ServerEvents;
redisEvents.RedisPubSub.Restart();