Open ggokka opened 5 years ago
The important thing to understand about gRPC is that it doesn’t support multi-casting. This is where SignalR shines and why it’s the right tool for Blazor. There is not a silver bullet in software, everything has its strengths and weaknesses.
You can multicast with grpc with custom code.
SignalR will be sufficient for most of scenarios when building either Client or Server-Side Blazor apps. The most common usages like updating DOM dynamically, chat messages, notifications, message queues, logging, smallish data chunks exchange SignalR is less complex to set-up, deploy and run as it's already baked in which results in a rather pleasant and timely rewarding experience ;)
gRPC comes in really handy in slightly more advanced scenarios such as:
Does that make more sense now when to choose SignalR over gRPC?
@chrissainty I'm far from a Blazor expert but does it actually need or rely on multi-casting anywhere?
In my opinion using SignalR as the primary communication later between client and server isn't that great an idea, especially given you have to use Azure SignalR (or roll your own service), which means more $$$ and more infra. to manage and unless you're rolling a HA solution, users if different parts of the globe will be in for a poor experience given every DOM interaction has to be communicated over websockets, back to the host.
For that reason I would have thought gRPC would be a much better fit for Blazor given it uses HTTP/2 to provide long-lived, real-time communication streams.
Again, I'm sure there are gaps in my knowledge here.
We use gRPC in Blazor server applications with bidirectional streaming. Multicasting is realized with our "multicating server streaming code" (I can publish it when anybody is interested) where client calls are held by server and used for multicasting to clients. But there is still one issue which makes us troubles and prevents us from keeping long lived server streaming calls with low cadency of messages to working and requires periodical recalls to make it work: https://github.com/grpc/grpc/issues/23001#issuecomment-657860447
I've found some Blazor examples with gRPC service. gRPC and SignalR are very similar behavior. That is remote access data.
Since the Blazor, we should take gRPC? if you would think so. tell me the advantage of the gRPC.
ps. I know the event handling on Blazor client side are implemented by SignalR. How about chatting app or stock dashboard? Which technology would you choice? (https://www.c-sharpcorner.com/article/understanding-server-side-blazor/)