---
title: Websocket Server
slug: telemetry-pipeline/websocket-server
docTags: 
createdAt: 2025-04-21T01:03:55.567Z
---

# WebSocket Server Sink

The **WebSocket Server sink** exposes a WebSocket **server endpoint** that allows external clients to connect and receive **logs, metrics, or traces** streamed directly from worker.
&#x20;Unlike the websocket sink (client mode), this component **listens for incoming WebSocket connections** and pushes events to connected clients.

It is suitable for:

- Real-time dashboards&#x20;
- Custom consumers&#x20;
- Streaming observability data to multiple downstream clients&#x20;
- Fan-out delivery patterns&#x20;

## Core Sink Configuration

### type

**Required**
&#x20;Defines the sink type.

- Must be set to websocket\_server&#x20;
- Puts worker into **WebSocket server mode**&#x20;

### inputs

**Required**
&#x20;List of upstream sources or transforms that send events to this sink.

- Accepts one or more component IDs&#x20;
- Wildcards (\*) are supported&#x20;

### address

**Required**
&#x20;Socket address that the WebSocket server listens on.

- Must include a port&#x20;
- Listens on all interfaces or a specific interface&#x20;

**Examples**

:::BlockQuote
0.0.0.0:80
127.0.0.1:9000
:::

## Acknowledgements

### acknowledgements

**Optional**
&#x20;Controls end-to-end acknowledgement behavior for the sink.

### acknowledgements.enabled

**Optional**
&#x20;Enables end-to-end acknowledgements.

- When enabled, sources that support acknowledgements wait until
  &#x20;**all connected sinks acknowledge the event**&#x20;
- Sink-level configuration overrides global acknowledgement settings&#x20;
- Useful when reliability is more important than throughput&#x20;

## Authentication (auth)

Authentication applies to **incoming WebSocket connection requests**.

:::BlockQuote
⚠️ Authentication headers are not encrypted unless TLS is enabled.
&#x20;**Use authentication only with HTTPS / WSS.**
:::

### auth.strategy

**Required (when auth is configured)**
&#x20;Authentication method used by the server.

Supported strategies:

- basic – HTTP Basic Authentication&#x20;
- custom – Custom authentication using VRL&#x20;

### Basic Authentication

auth.username

**Required**
&#x20;Username for HTTP Basic authentication.

auth.password

**Required**
&#x20;Password for HTTP Basic authentication.

**Behavior**

- Client must send Authorization: Basic ... header&#x20;
- Credentials are base64-encoded&#x20;

### Custom Authentication (VRL)

auth.source

**Required**
&#x20;A VRL boolean expression executed for each connection request.

- Has access to request metadata&#x20;
- Must return true to allow the connection&#x20;
- Returning false rejects the client&#x20;

**Typical use cases**

- Header-based token validation&#x20;
- Query parameter checks&#x20;
- IP-based access control&#x20;

## Buffer Configuration

### buffer

**Optional**
&#x20;Controls how events are queued before being sent to connected clients.

### buffer.type

**Optional**
&#x20;Type of buffer used.

- memory (default) – Fast, volatile&#x20;
- disk – Durable, survives restarts&#x20;

### buffer.max\_events

**Optional**
&#x20;Maximum number of events stored in memory.

- Only applies when type = "memory"&#x20;
- Default: 500&#x20;

### buffer.max\_size

**Required**
&#x20;Maximum memory or disk space allowed for buffering.

- Disk buffers must be **at least \~256 MB**&#x20;

### buffer.when\_full

**Optional**
&#x20;Behavior when the buffer is full.

- block (default) – Apply backpressure&#x20;
- drop\_newest – Drop incoming events&#x20;

## Encoding

### encoding

**Required**
&#x20;Controls how events are serialized before being sent to WebSocket clients.

The selected codec also determines which signal types are supported.

### encoding.codec

**Required**
&#x20;Serialization format.

Supported codecs include:

- json&#x20;
- text&#x20;
- raw\_message&#x20;
- csv&#x20;
- avro&#x20;
- cef&#x20;
- gelf&#x20;
- protobuf&#x20;
- otlp&#x20;
- native&#x20;
- native\_json&#x20;
- logfmt&#x20;

### JSON Encoding

encoding.json.pretty

**Optional**
&#x20;Pretty-print JSON output.

- Default: false&#x20;
- Increases readability but adds overhead&#x20;

### CSV Encoding

encoding.csv.fields

**Required**
&#x20;Ordered list of fields to include in CSV output.

encoding.csv.delimiter

**Optional**
&#x20;Field delimiter character.

- Default: ,&#x20;

encoding.csv.quote\_style

**Optional**
&#x20;Controls when fields are quoted.

- necessary (default)&#x20;
- always&#x20;
- never&#x20;
- non\_numeric&#x20;

### CEF Encoding

Used primarily for SIEM integrations.

Required fields include:

- device\_vendor&#x20;
- device\_product&#x20;
- device\_version&#x20;
- device\_event\_class\_id&#x20;
- name&#x20;
- severity&#x20;
- version&#x20;
- extensions&#x20;

### Protobuf Encoding

encoding.protobuf.desc\_file

**Required**
&#x20;Path to the protobuf descriptor set file.

encoding.protobuf.message\_type

**Required**
&#x20;Protobuf message type name.

encoding.protobuf.use\_json\_names

**Optional**
&#x20;Use camelCase JSON field names instead of snake\_case.

- Default: false&#x20;

### Timestamp Formatting

encoding.timestamp\_format

**Optional**
&#x20;Controls timestamp representation.

Options:

- rfc3339&#x20;
- unix&#x20;
- unix\_float&#x20;
- unix\_ms&#x20;
- unix\_us&#x20;
- unix\_ns&#x20;

## Internal Metrics

### internal\_metrics

**Optional**
&#x20;Controls extra tags added to metrics generated by this component.

### internal\_metrics.extra\_tags

**Optional**
&#x20;Defines additional metric tags.

internal\_metrics.extra\_tags.\*.type

Defines how the tag value is derived.

Supported values:

- fixed – Static value&#x20;
- header – Value from a request header&#x20;
- query – Value from a query parameter&#x20;
- ip\_address – Client IP address&#x20;
- url – Full request URL&#x20;

internal\_metrics.extra\_tags.\*.value

**Required (for fixed)**
&#x20;Static value assigned to the tag.

internal\_metrics.extra\_tags.\*.with\_port

**Optional**
&#x20;Include port when using ip\_address.

- Default: false&#x20;

## Message Buffering (Replay Support)

### message\_buffering

**Optional**
&#x20;Enables message replay for clients that connect later.

- Uses a ring buffer&#x20;
- Oldest messages are dropped when buffer is full&#x20;

### message\_buffering.max\_events

**Optional**
&#x20;Maximum number of messages stored for replay.

- Default: 1000&#x20;

### message\_buffering.message\_id\_path

**Optional**
&#x20;Field path containing the message ID.

- Exposes the ID to clients&#x20;
- Clients can request replay starting from a given ID&#x20;

## Client ACK Support (Advanced Replay)

### message\_buffering.client\_ack\_config

**Optional**
&#x20;Enables server-side tracking of client acknowledgements.

- Allows replay without query parameters&#x20;
- Server tracks last acknowledged message per client&#x20;

### client\_key

Identifies a client uniquely.

client\_key.type

- ip\_address (default)&#x20;
- header&#x20;

client\_key.name

**Required when type = "header"**
&#x20;Header name used as the client identifier.

client\_key.with\_port

Include port when using IP-based identification.

### message\_id\_path

**Required**
&#x20;Path to the message ID field used for ACK tracking.

### ack\_decoding

Defines how ACK messages from clients are decoded.

Supported codecs:

- bytes&#x20;
- json&#x20;
- protobuf&#x20;
- avro&#x20;
- gelf&#x20;
- syslog&#x20;
- influxdb&#x20;
- otlp&#x20;
- native&#x20;
- native\_json&#x20;
- vrl&#x20;

Each codec has its own optional lossy, schema, and validation settings.

## Subprotocol Handling

### subprotocol

**Optional**
&#x20;Controls Sec-WebSocket-Protocol negotiation.

### subprotocol.type

**Optional**

- specific (default) – Only allow listed subprotocols&#x20;
- any – Accept any client-requested subprotocol&#x20;

### subprotocol.supported\_subprotocols

**Optional**
&#x20;List of allowed subprotocols when type = "specific".

## TLS Configuration

### tls.enabled

**Optional**
&#x20;Enables TLS for incoming connections.

- Required for wss\://&#x20;

### tls.ca\_file

Additional trusted CA certificates.

### tls.crt\_file

Server certificate.

### tls.key\_file

Private key for the certificate.

### tls.key\_pass

Passphrase for encrypted private keys.

### tls.verify\_certificate

Enforces client certificate validation.

### tls.verify\_hostname

Validates hostname against certificate CN/SAN.
