envision.server module
- class envision.server.BroadcastWebSocket(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This websocket receives the SMARTS state (the other end of the open websocket is held by the Envision Client (SMARTS)) and broadcasts it to all web clients that have open web-sockets via the StateWebSocket handler.
- class envision.server.FileHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This handler serves files to the given requester.
- class envision.server.Frame(data: str, timestamp: float, next_=None)[source]
A frame that describes a single envision simulation step.
- property data
The raw envision data.
- property size
The byte size of the frame’s raw data.
- property timestamp
The timestamp for this frame.
- class envision.server.Frames(max_capacity_mb=500)[source]
A managed collection of simulation frames. This collection uses a random discard of simulation frames to stay under capacity. Random discard favors preserving newer frames over time.
- property elapsed_time: float
The total elapsed time between the first and last frame.
- property start_time: float | None
The first timestamp in all available frames.
- class envision.server.MainHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This handler serves the index file.
- class envision.server.MapFileHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This handler serves map geometry to the given endpoint.
- class envision.server.ModelFileHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This model file handler serves vehicle and other models to the client.
- class envision.server.SimulationListHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This handler serves a list of the active simulations.
- class envision.server.StateWebSocket(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]
This websocket sits on the other side of the web client. It handles playback and playback control messages from the web-client.
- class envision.server.WebClientRunLoop(frames: Frames, web_client_handler: WebSocketHandler, message_frequency: float, message_frame_volume: int, seek: int | None = None)[source]
The run loop is like a “video player” for the simulation. It supports seeking and playback. The run loop wraps the web client handler and pushes the frame messages to it as needed.