0
Synchronise websocket message among 3 server instances
I'm new to websockets and I have implemented websocket using SignalR everything works fine in local and test environment but doesn't work in production the reason is in prod I have 3 instances and due to that sometimes I don't get the message if user is connected to 1 instance and the message is sent from another instance. How can I synchronise the messages considering the budget constraints too. I'm currently using azure SignalR free version but it's unreliable and I cannot even test it too. Is there anything which I can try? I'm using.net for backend and front end react. And using asp.net SignalR feature and azure app service.
1 Respuesta
+ 1
Hi Initiator!
When you run multiple application instances, in-memory SignalR hubs cannot communicate with each other; in simpler words: each instance only knows about the connections it hosts.
Azure explicitly states that the Free tier is not intended for production; it imposes connection limits and is intentionally limited and unstable for multi-instance scenarios. That is why you are seeing unreliable behaviour.
Consider using a backplane to fix this issue.
SignalR supports Redis as a self-hosted backplane. All your app instances publish/subscribe through Redis and hence, messages are forwarded across all connected servers. This way, your websocket clients receive the broadcast regardless of which instance they are connected to.
Redis is the recommended official Microsoft backplane for ASP.NET Core SignalR. Also, it is reliable and cheap.
Read more here: https://learn.microsoft.com/en-us/aspnet/core/signalr/redis-backplane?view=aspnetcore-10.0
Hope it helps.
Thank you.



