Add websocket event stream for sim updates.

As a proof of concept this only covers the flight positions.
This commit is contained in:
Dan Albert
2022-02-16 01:28:10 -08:00
parent 350f08be2f
commit 21f7912458
14 changed files with 150 additions and 15 deletions

View File

@@ -72,6 +72,11 @@ class GameLoop:
self.completed = True
def send_update(self, rate_limit: bool) -> None:
# We don't skip empty events because we still want the tick in the Qt part of
# the UI, which will update things like the current simulation time. The time
# probably be an "event" of its own. For now the websocket endpoint will filter
# out empty events to avoid the map handling unnecessary events, but we still
# pass the events through to Qt.
now = datetime.now()
time_since_update = now - self.last_update_time
if not rate_limit or time_since_update >= timedelta(seconds=1 / 60):