updates WebServer docstring

This commit is contained in:
Mose Müller 2023-12-19 11:09:29 +01:00
parent 37ae34ecc0
commit 08a62b2119

View File

@ -19,34 +19,27 @@ logger = logging.getLogger(__name__)
class WebServer: class WebServer:
""" """
A Protocol that defines the interface for additional servers. Represents a web server that adheres to the AdditionalServerProtocol, designed to
work with a DataService instance. This server facilitates client-server
communication and state management through web protocols and socket connections.
This protocol sets the standard for how additional servers should be implemented The WebServer class initializes and manages a web server environment using FastAPI
to ensure compatibility with the main Server class. The protocol requires that and Socket.IO, allowing for HTTP and WebSocket communications. It incorporates CORS
any server implementing it should have an __init__ method for initialization and a (Cross-Origin Resource Sharing) support, custom CSS, and serves a frontend static
serve method for starting the server. files directory.
Parameters: Args:
----------- data_service_observer (DataServiceObserver): Observer for the DataService,
service: DataService handling state updates and communication to connected clients.
The instance of DataService that the server will use. This could be the main host (str): Hostname or IP address where the server is accessible. Commonly
application or a specific service that the server will provide. '0.0.0.0' to bind to all network interfaces.
port (int): Port number on which the server listens. Typically in the range
port: int 1024-65535 (non-standard ports).
The port number at which the server will be accessible. This should be a valid css (str | Path | None, optional): Path to a custom CSS file for styling the
port number, typically in the range 1024-65535. frontend. If None, no custom styles are applied. Defaults to None.
enable_cors (bool, optional): Flag to enable or disable CORS policy. When True,
host: str CORS is enabled, allowing cross-origin requests. Defaults to True.
The hostname or IP address at which the server will be hosted. This could be a **kwargs (Any): Additional unused keyword arguments.
local address (like '127.0.0.1' for localhost) or a public IP address.
state_manager: StateManager
The state manager managing the state cache and persistence of the exposed
service.
**kwargs: Any
Any additional parameters required for initializing the server. These parameters
are specific to the server's implementation.
""" """
def __init__( # noqa: PLR0913 def __init__( # noqa: PLR0913