### Socket · class

Server-side socket for pushing data to a client. Server functions with `Socket<T>` parameters
receive client callbacks on the client side.

**Type Parameters:**

- `T`

**Examples:**

```ts
// Server
export function streamNumbers(socket: Socket<number>) {
  setInterval(() => {
    if (!socket.send(Math.random())) clearInterval(interval);
  }, 1000);
}

// Client
api.streamNumbers(num => console.log(num));
```

#### socket.send · method

Sends data to the client.

**Signature:** `(data: T) => number`

**Parameters:**

- `data: T` - - Data to send (automatically serialized)

**Returns:** `true` if sent, `false` if socket is closed

#### socket.subscribe · method

**Signature:** `(channel: Uint8Array<ArrayBufferLike>, delta?: number) => void`

**Parameters:**

- `channel: Uint8Array`
- `delta: any` (optional)

#### socket.toString · method

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

#### socket.[Symbol.for('nodejs.util.inspect.custom')] · method

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