> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nanoforge.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# TCPServer class

> Reliable, ordered WebSocket-based server that manages multiple TCP clients.

# TCPServer

## Summary

Reliable, ordered WebSocket-based server that manages multiple TCP clients.

## Signature

```typescript theme={null}
declare class TCPServer 
```

## Constructors

### constructor

Constructs a new instance of the class

## Methods

### getConnectedClients

Return a snapshot array of numeric client IDs currently connected.

### getReceivedPackets

Parse and return complete packets received from each client. Each packet is a buffer.

### listen

Start the WebSocket server and begin accepting clients.

### sendToClient

Send a payload to the client identified by .

### sendToEverybody

Send a payload to every connected client.

## Remarks

Each client that connects is assigned a numeric ID. Use `getConnectedClients` to enumerate active clients, `sendToClient` / `sendToEverybody` to push data, and `getReceivedPackets` to consume incoming packets per frame.  Typical usage is through `NetworkServerLibrary` which instantiates and starts this class automatically during `__init`.
