---
title: "vuer.base"
section: "Python API"
order: 3
description: "Python API reference for vuer.base"
---

# vuer.base

## default_handler

```python
async def default_handler(request, ws)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.71/src/vuer/base.py#L14)

## websocket_handler

```python
async def websocket_handler(request, handler, **ws_kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.71/src/vuer/base.py#L19)

## handle_file_request

```python
async def handle_file_request(request, root, filename=None)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.71/src/vuer/base.py#L40)

## Server

```python
class Server
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.71/src/vuer/base.py#L72)

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).

```python
host: str = EnvVar('HOST', default='localhost').get()
```

```python
port: int = EnvVar('PORT', dtype=int, default=8012).get()
```

```python
cors: str = EnvVar('CORS', default='*').get()
```

```python
cert: str = EnvVar('SSL_CERT', default=None).get()
```

```python
key: str = EnvVar('SSL_KEY', default=None).get()
```

```python
ca_cert: str = EnvVar('SSL_CA_CERT', default=None).get()
```

```python
WEBSOCKET_MAX_SIZE: int = EnvVar('WEBSOCKET_MAX_SIZE', dtype=int, default=2 ** 28).get()
```

```python
REQUEST_MAX_SIZE: int = EnvVar('REQUEST_MAX_SIZE', dtype=int, default=2 ** 28).get()
```

## Server.start

```python
def start(self)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.71/src/vuer/base.py#L160)
