TCP
Synopsis
Creates a server that accepts network messages over TCP connections. Supports both plain and TLS-encrypted connections, with configurable framing modes, connection management, and buffering options.
Schema
- id: <numeric>
name: <string>
description: <string>
type: tcp
tags: <string[]>
pipelines: <pipeline[]>
status: <boolean>
properties:
protocol: <string>
address: <string>
port: <numeric>
framing: <string>
line_delimiter: <string>
max_connections: <numeric>
timeout: <numeric>
max_message_size: <numeric>
reuse: <boolean>
workers: <numeric>
buffer_size: <numeric>
batch_size: <numeric>
queue:
interval: <numeric>
tls:
status: <boolean>
cert_name: <string>
key_name: <string>
Configuration
The following fields are used to define the device:
Device
Field | Required | Default | Description |
---|---|---|---|
id | Y | Unique identifier | |
name | Y | Device name | |
description | N | - | Optional description |
type | Y | Must be tcp | |
status | N | true | Enable/disable the device |
Connection
Field | Required | Default | Description |
---|---|---|---|
protocol | N | "tcp" | Transport protocol (must be tcp) |
address | N | "0.0.0.0" | Listen address |
port | Y | Listen port |
TCP
Field | Required | Default | Description |
---|---|---|---|
framing | N | "delimiter" | Framing mode (delimiter or octet ) |
line_delimiter | N | "\n" | Line separator for delimiter framing |
max_connections | N | 10000 | Maximum concurrent connections |
timeout | N | 300 | Connection timeout in seconds |
max_message_size | N | 20971520 | Maximum message size in bytes (20MB) |
When using delimiter framing, ensure that the line_delimiter
matches the client's to prevent message parsing errors.
TLS
Field | Required | Default | Description |
---|---|---|---|
tls.status | N | false | Enable TLS encryption |
tls.cert_name | Y | TLS certificate file path (required if TLS enabled) | |
tls.key_name | Y | TLS private key file path (required if TLS enabled) |
The TLS certificate and key files must be placed in the service root directory.
Advanced Configuration
To enhance performance and achieve better message handling, the following settings are used.
Performance
Field | Required | Default | Description |
---|---|---|---|
reuse | N | true | Enable socket address reuse |
workers | N | <dynamic> | Number of worker processes when reuse is enabled |
buffer_size | N | 1048576 | Network read buffer size in bytes (1MB) |
Messages
Field | Required | Default | Description |
---|---|---|---|
batch_size | N | 1000 | Number of messages to batch before processing |
queue.interval | N | 1 | Queue processing interval in seconds |
Examples
The following are commonly used configuration types.
Basic
A basic server can be easily created using "tcp"
for protocol
, "0.0.0.0"
for address
, and the default framing and timeout settings.
Creating a simple TCP server... |
|