I'm new to Blazor and I'm trying to use the server-side model using .NET Core 3.0.
I'm trying to set up a simple multi-user vector drawing application which allows multiple users to create shapes on the same canvas.
The shapes and parameters etc are all stored in the database, and there are many canvases.
My question is, given two (or more) users are viewing the same canvas, how can the state be kept up to date as other users create new shapes? How can I detect which other users are viewing or editing the same canvas?
TIA.
How different is this now, in almost 2024?
You can keep track of where all of the users are by wrapping a NavigationManager in a Singleton service.
For the shapes, you can use a similar idea - have your services that manipulate shapes notify a Singleton service, which can then raise events to all subscribers for that page (which are the users as determined by your NavigationManager wrapper).