Server
SimViewServer is the FastAPI app that serves a scene's model/states (or
per-blob columnar endpoints) to the browser, and handles WebSocket live-push. Most
users won't instantiate this directly — see SimulationScene.show(), LiveViewer,
or the simview CLI instead.
simview.server.SimViewServer
SimViewServer(
sim_path: str
| Path
| Sequence[str | Path]
| None = None,
data: dict | None = None,
live: bool = False,
frame_buffer_size: int = _LIVE_FRAME_BUFFER_MAXLEN,
)
broadcast_episodes
async
Push updated episode boundaries to every connected /ws/states client.
A separate message kind from the frame broadcasts -- episodes describe the model, not a frame, and arrive far more rarely. See the onmessage handler in SimView.js.
broadcast_frame
async
Send one newly-pushed frame to every connected /ws/states client.
Must run on self.loop (the server thread's event loop) -- LiveViewer schedules this via asyncio.run_coroutine_threadsafe from its sender thread rather than calling it directly.