RoyDefined / WebDoomer

WebDoomer is a fast and efficient Zandronum and QZandronum server browser as a web app.
GNU General Public License v3.0
4 stars 0 forks source link

Automatically refresh the server list each time the backend fetches updated server data #9

Open RoyDefined opened 5 months ago

RoyDefined commented 5 months ago

Is your feature request related to a problem? Please describe. Currently the server list can become stale in the front end if the user does not reload the servers by reloading the page.

Describe the solution you'd like The front end should implement a SignalR connection to the backend and listen for changes. Once the backend emits a change through the connection the front end should refetch all servers.

Describe alternatives you've considered Front end could also periodically ping the server and ask for the last time the servers were fetched. This removes the need for a SignalR system, but the updated servers will not apply as quickly.

Additional context N/A

RoyDefined commented 4 months ago

This is implemented as of 77dd16b.

RoyDefined commented 4 months ago

I am reopening this as I want to introduce a second form of refreshing to the application that does not rely on a websocket to be opened. I notice this is not the best way to do this as a websocket might not always be supported. Instead I want to introduce a way of refreshing the list periodically which depends on the frontend to communicate with the backend and ask if a new list exists.

I think a good way of doing this is to introduce an endpoint to the backend that returns how old the current list is, and to compare that to how old the frontend list is. If the frontend list is older, the server has a newer list to refresh.