nanover.websocket.server module

class nanover.websocket.server.WebSocketServer(app_server: AppServer)

Bases: object

classmethod basic_server(app_server: AppServer, *, port: int = 0, ssl: SSLContext | None = None, insecure=True) WebSocketServer

Create a server for the given AppServer, listening for connection over one or both of insecure (ws) and secure (wss) websockets.

close() None

Close all open connections, subscriptions, and stop listening for new connections.

serve(*, host='0.0.0.0', port=0, ssl: SSLContext | None = None, service: str | None = None) Server

Listen for websocket connections on the given host and port, using SSL if a context is provided, and registering under discovery if a service name is provided.