### ServerProxy · class

Wraps a server-side API object to create a stateful, type-safe proxy accessible from clients.
Use for authentication, sessions, or any stateful context that persists across RPC calls.

If the API object has an `onDrop()` method, it is called when the proxy is dropped, either
because the client cancelled the request (scope cleanup) or the WebSocket disconnected.
Use this to clean up server-side state kept on behalf of the client.

**Type Parameters:**

- `API extends object`
- `RETURN`

**Examples:**

```ts
export class UserAPI {
  constructor(public user: User) {}
  getSecret() { return this.user.secret; }
  onDrop() { console.log('client gone'); }
}

export async function authenticate(token: string) {
  const user = await validateToken(token);
  return new ServerProxy(new UserAPI(user), user.name);
}

// Client: auth.value is user name, auth.serverProxy.getSecret() calls UserAPI method
```

**Constructor Parameters:**

- `api`: - Server-side API object exposed to the client
- `value`: - Value returned immediately to the client

#### serverProxy.toString · method

**Signature:** `() => string`
