> For the complete documentation index, see [llms.txt](https://vancete.gitbook.io/socks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vancete.gitbook.io/socks/net-types/custom-types.md).

# Custom Types

With custom types you can add your very own Net Types without editing the main server code. It's recommended to use 4 digits for custom Net Types to avoid collisions with the main Net Types that are using 3 digits.

### Basic example

Go to /custom folder and open the custom-types.js file.

You'll see an empty function there. Let's add some juice with a basic echo function.

```csharp
const customTypes = (sock, message) => {
    switch (message.type) {
        case 1000:
            sock.send(utils.objToByteArray({ type: 1000, data: { message: message.data.message } }))
            break;
    
        default:
            break;
    }
}
```

So, if we send this message:

```csharp
{"type": 1000, "data": {"message": "Hello!"}}
```

We'll receive:

```csharp
{"type":1000,"data":{"message":"Hello!"}}
```

Easy, isn't it?
