Gateway User Manual

Last updated: 2025-12-09

What It Is

How to Run (Local)

Remote Access

Multiple Gateways (Same Host)

Usually not needed: one Gateway can serve multiple messaging channels and agents. Only use multiple Gateways when you need redundancy or strict isolation (e.g., rescue bot). Supported if you isolate state + config and use unique ports. Full guide: Multiple Gateways. Service names are profile-aware:

Installation metadata embedded in service config:

Rescue bot mode: Keep a second Gateway isolated with its own config, state directory, workspace, and base port offset. Full guide: Rescue Bot Guide.

Dev Profile (--dev)

Quick path: Run a fully isolated dev instance (config/state/workspace) without touching your main setup.

Defaults (overridable via env/flags/config):

Derived ports (rule of thumb):

Per-instance checklist:

Install service by profile:

Example:

Protocol (Operations Perspective)

Methods (Initial Set)

See also: Presence for how presence is produced/deduplicated and why stable client.instanceId matters.

Events

WebChat Integration

Types and Validation

Connection Snapshot

Error Codes (res.error shape)

Keepalive Behavior

Replay / Gaps

Supervision (macOS Example)

Gateway Service Management (CLI)

Use the Gateway CLI for install/start/stop/restart/status:

Notes:

Bundled macOS app:

Supervision (systemd User Unit)

OpenClaw installs systemd user services by default on Linux/WSL2. We recommend user services for single-user machines (simpler env, per-user config). For multi-user or resident servers use system services (no lingering, shared supervision). openclaw gateway install writes the user unit. openclaw doctor audits the unit and can update it to match current recommended defaults. Create ~/.config/systemd/user/openclaw-gateway[-<profile>].service:

Enable lingering (required so user services survive logout/idle):

The wizard runs this command on Linux/WSL2 (may prompt for sudo; writes to /var/lib/systemd/linger). Then enable the service:

Alternative (system service) - For resident or multi-user servers, you can install systemd system units instead of user units (no lingering required). Create /etc/systemd/system/openclaw-gateway[-<profile>].service (copy the unit above, switch WantedBy=multi-user.target, set User= + WorkingDirectory=), then:

Windows (WSL2)

Windows installations should use WSL2 and follow the Linux systemd section above.

Operations Checklist

Security Guarantees

CLI Helpers

Migration Guide

For more about Gateway, see: Gateway User Manual - OpenClaw