adamfoneil / CardGameSDK

A library for creating and testing card games
https://cardplace.azurewebsites.net
0 stars 0 forks source link

real time updates on Ready page from different users #3

Closed adamfoneil closed 1 month ago

adamfoneil commented 1 month ago

On the Ready page, we should see updates (adds and removals) of other players without needing to refresh the page.

I have a StateContainer that relays appropriate events, and they even show up in the debugger in the right handler, but the page won't refresh. That is, this StateHasChanged call is having no effect. I tried await InvokeAsync(StateHasChanged) and this didn't work.

Here's a little demo of how I'm approaching this: https://1drv.ms/v/s!AvguHRnyJtWMm_wNRA5DTPv9LSSYew?e=ZbzAvS

adamfoneil commented 1 month ago

this is mostly working now via

Brief demo https://1drv.ms/v/s!AvguHRnyJtWMm_wPzHQJQLGgbpwMqw?e=AhNoij

I was trying to avoid using SignalR directly because I've never really understood it. But this is a little complicated what I've done here, so I don't know. Solution above doesn't handle the case when a single ready player is left -- something like that. I do like the durability of a SQL Server queue table and internal messaging infrastructure since it's purpose-built for game data in this app.