- if you use blazor server interactive mode, then the server app creates a dedicated client session and signal/r hub for each client connection. this server session would then become a websocket client to the push notification app, so the blazor app would have 2 websocket connections for each client. As chat api calls are typically a REST api call, the Blazor code would just make webclient call and update the UI chat log (it not really a peer to peer chat, but a UI that looks like one). the Gen AI server is stateless, you re-send all the desired context data (say chat history) with each request.
- web socket pooling is to handle client reconnects to the same peer. the connection is not closed, but returned to the pool. this only makes sense if the client initiates all the traffic, as there is no reciever while in the pool.
Best practices for implementing Notifications and Streaming (Gen AI-enabled chats) in Blazor Web App
Manoj Ganapathi
0
Reputation points
Need some architectural guidance.
I am building a B2C solution using Blazor Web App model. The entire stack is C# and runs on Azure. I am just trying to understand some best practices for integrating the following capabilities:
- Push Notifications (pushed through Azure Web PubSub)
- Streaming of Chat responses (in a Gen AI based ChatBot)
The broad questions relating to the above:
- Choice of Interactive mode for each of the above scenarios. The Blazor samples for Web PubSub are purely in WASM, but can I just carry that logic to Web Apps? Any other consideration to keep in mind (other than scaling the units on the PubSub service side in Azure).
- Can I pool Web Socket connection effectively across these scenarios (considering that Interactive Server mode also needs one).
Is EShop the reference I can use for patterns related to my context? Any other references?
Thanks in Advance!
1 answer
Sort by: Most helpful
-
Bruce (SqlWork.com) 70,376 Reputation points
2025-01-13T22:31:25.7833333+00:00