vuer.base

async vuer.base.default_handler(request, ws)[source]
async vuer.base.websocket_handler(request, handler, **ws_kwargs)[source]
async vuer.base.handle_file_request(request, root, filename=None)[source]
class vuer.base.Server[source]

Base TCP server with HTTP/WebSocket functionality.

This class provides the core server infrastructure for Vuer, including: - HTTP route handling with CORS support - WebSocket connection management - SSL/TLS support for secure connections - Static file serving

Subclasses should call _init_app() in their __post_init__ to initialize the aiohttp application before using server methods.

Note: This class cannot use @proto.prefix because Vuer inherits from it and also uses @proto.prefix, which causes a metaclass conflict.

Attributes:

host: Server hostname. Set to “0.0.0.0” to accept remote connections. port: Server port number. cors: Comma-separated list of allowed CORS origins. Use “*” for all. cert: Path to SSL certificate file for HTTPS. key: Path to SSL private key file for HTTPS. ca_cert: Path to CA certificate for client certificate verification. WEBSOCKET_MAX_SIZE: Maximum WebSocket message size (default 256MB). REQUEST_MAX_SIZE: Maximum HTTP request size (default 256MB).

host: str = 'localhost'
port: int = 8012
cors: str = '*'
cert: str = None
key: str = None
ca_cert: str = None
WEBSOCKET_MAX_SIZE: int = 268435456
REQUEST_MAX_SIZE: int = 268435456
_init_app()[source]

Initialize the aiohttp application and CORS context.

This must be called before using any server methods. Subclasses should call this in their __post_init__ method.

Creates:

self.app: The aiohttp web.Application instance. self.cors_context: The aiohttp_cors setup for CORS handling.

_add_route(path: str, handler: callable, method: str = 'GET')[source]
Parameters:
  • path (str) –

  • handler (callable) –

  • method (str) –

_socket(path: str, handler: callable)[source]
Parameters:
  • path (str) –

  • handler (callable) –

static _add_task(fn: Coroutine, name=None)[source]
Parameters:

fn (Coroutine) –

_add_static(path, root)[source]
_static_file(path, root, filename=None)[source]
start()[source]
__annotations__ = {'REQUEST_MAX_SIZE': <class 'int'>, 'WEBSOCKET_MAX_SIZE': <class 'int'>, 'ca_cert': <class 'str'>, 'cert': <class 'str'>, 'cors': <class 'str'>, 'host': <class 'str'>, 'key': <class 'str'>, 'port': <class 'int'>}