wasAsked.

How would you implement real-time notifications using SignalR while handling reconnects and authorization?

Swiggy · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, ASP.NET Core, React

Community answers

Posted by wasAsked editorial collection

SignalR is useful for server-pushed updates such as order status, notifications, and dashboards. Treat a connection as transient: reconnects occur, messages can be missed, and a client may have several connections. Example: public Task JoinOutlet(Guid outletId) { AuthorizeOutlet(outletId); return Groups.AddToGroupAsync(Context.ConnectionId, $"outlet:{outletId}"); } await hub.Clients.Group($"outlet:{outletId}").SendAsync("OrderChanged", dto, ct); Authorize group membership from server-side claims, never from an untrusted ID alone. Send small events and let clients reload authoritative state after reconnect. For multiple instances use a supported backplane/service, and apply rate limits, versioned payloads, correlation, and disconnect cleanup.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics