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

# Transport Configuration

> Configure how Edge Server communicates with other peers in the mesh network

Transport configuration controls how the Edge Server communicates with other peers in the mesh network. You can enable or disable specific transport protocols based on your deployment environment.

## Available Transports

Edge Server supports the following transport protocols:

* **LAN:** Local Area Network connections over WiFi or Ethernet
* **Bluetooth LE:** Bluetooth Low Energy

All transports are enabled by default where supported, with mDNS enabled for automatic peer discovery on LAN.

## Basic Configuration

In the most basic use case, you can omit transport config and rely on defaults, this will enable
all available P2P transports and turn on mDNS for peer discovery:

```yaml theme={null}
database:
  db_id: "YOUR_APP_ID"
  device_name: "edge-device-1"
  auth:
    # ... auth configuration
```

## Advanced Configuration

For fine-grained control over individual transports:

```yaml theme={null}
database:
  db_id: "YOUR_APP_ID"
  device_name: "edge-device-1"
  transport_config:
    peer_to_peer:
      ble_enabled: false
      lan_enabled: true
      lan_mdns_enabled: false # Auto-discover peers with same db_id
  auth:
    # ... auth configuration
```

## Direct Static Connections

This section describes how to configure direct static connections between peers.
This can be thought of as a "hub-and-spoke" model where one or more central
nodes (hubs) accept incoming connections from edge nodes (spokes). In the
"spoke", you set the transport configuration to connect directly to the IP
address of the hub. For more information read [the transport
configuration SDK API Guide](/sdk/v5/sync/customizing-transport-configurations).

**Use Cases**

* **Air-gapped networks:** Secure facilities with no external connectivity
* **Edge computing:** Factory floors, warehouses, or retail environments
* **Privacy-first deployments:** Keep all data local to your network

For networks where mDNS is unavailable or blocked, configure known peers explicitly:

```yaml theme={null}
# Central hub node
database:
  db_id: "YOUR_APP_ID"
  device_name: "central-hub"
  auth:
    small_peer_only:
      offline_license_token: "YOUR_OFFLINE_LICENSE"
  transport_config:
    # Accept incoming connections
    listen_config:
      tcp_listen:
        enable: true
        ip: "0.0.0.0"
        port: 4040
    peer_to_peer:
      lan_enabled: true
      lan_mdns_enabled: false  # Disable auto-discovery
  subscriptions:
    - "SELECT * FROM sensors"
    - "SELECT * FROM alerts WHERE priority >= 3"

# HTTP API for local access
http_server:
  listen_addr: "0.0.0.0:8080"
  tls_config: dev_mode
  http_api: true

auth: dev_mode
```

An example Edge Server "Spoke" configuration:

```yaml theme={null}
# Edge node configuration (connect to hub)
database:
  db_id: "YOUR_APP_ID"  # Same ID to form mesh
  device_name: "edge-node-01"
  auth:
    small_peer_only:
      offline_license_token: "YOUR_OFFLINE_LICENSE"
  transport_config:
    connect_config:
      known_tcp_servers:
        - "192.168.1.100:4040"  # Hub IP address
      retry_interval_msec: 5000
    peer_to_peer:
      lan_enabled: true
      lan_mdns_enabled: false

auth: dev_mode
```

## Multi-Transport Mesh

Enable multiple transports for maximum control in challenging environments:

```yaml theme={null}
database:
  db_id: "11111111-2222-4333-4444-555555555555"
  device_name: "multi-transport-node"
  auth:
    small_peer_only:
      offline_license_token: "YOUR_OFFLINE_LICENSE"
  transport_config:
    # Enable all peer-to-peer transports
    peer_to_peer:
      ble_enabled: true         # For mobile devices
      lan_enabled: true         # For network connectivity
      lan_mdns_enabled: true    # For automatic discovery
      lan_multicast_enabled: true
    # Also listen for TCP connections
    listen_config:
      tcp_listen:
        enable: true
        ip: "0.0.0.0"
        port: 4040
    # Connect to known peers
    connect_config:
      known_tcp_servers:
        - "gateway.local:4040"
      known_ws_servers:
        - "ws://backup.local:8080"
      retry_interval_msec: 10000

auth: dev_mode
```

See the [transport configuration reference](/edge-server/configuration/reference/ditto-database-resource#transport-configuration) for more details.

## Platform-Specific Notes

### Bluetooth LE

* For Linux deployments, see the [Deploying on Linux guide](/sdk/v5/deployment/bluetooth-on-linux) for BlueZ requirements and setup
* May need elevated permissions
* Range typically 10-30 meters depending on environment

### mDNS Discovery

* Uses Bonjour on macOS
* Ensure firewall allows mDNS traffic (port 5353)
* Automatically discovers peers on the same network
* See [Deploying on LAN guide](/sdk/v5/deployment/network-deployment) for more details

## Common Configurations

### LAN-Only Configuration

For deployments within a single network:

```yaml theme={null}
transport_config:
  peer_to_peer:
    ble_enabled: false
    lan_enabled: true
    lan_mdns_enabled: true
```

### Static Peer Configuration

For known, fixed deployments:

```yaml theme={null}
transport_config:
  listen_config:
    tcp_listen:
      enable: true
      ip: "0.0.0.0"
      port: 4040
  connect_config:
    known_tcp_servers:
      - "192.168.1.100:4040"
```

## Troubleshooting

### Peers Not Discovering Each Other

If using mDNS discovery:

```yaml theme={null}
transport_config:
  peer_to_peer:
    lan_enabled: true
    lan_mdns_enabled: true  # Must be true
```

Check:

* Firewall allows UDP port 5353
* Nodes are on the same network segment
* mDNS/Bonjour services are running

### Connection Refused Errors

For TCP connections:

```yaml theme={null}
listen_config:
  tcp_listen:
    enable: true
    ip: "0.0.0.0"  # Accept from any interface
    port: 4040     # Ensure unique port
```

Verify:

* Port is not already in use
* Firewall allows the configured port
* IP address is correct in `known_tcp_servers`
