Gateway - Neotask by Neotask Documentation | Neotask

Gateway

Gateway क्या है?

Gateway Open Claw का heart है — एक single long-running service जो सभी agent sessions, messaging channels, tool execution, और device connections manage करती है। सब कुछ Gateway के माध्यम से होता है।

यह एक WebSocket server है जो clients (desktop app, mobile apps, web dashboard) से connections के लिए listen करता है और पूरे AI assistant lifecycle को manage करता है।

Architecture

Components

  • WebSocket Server — Client connections accept करता है (default port 18789)
  • HTTP Server — Control UI, canvas host, और health endpoints serve करता है
  • Channel Adapters — Messaging platforms (WhatsApp, Telegram, Discord, आदि) से connections maintain करते हैं
  • Session Manager — Agent conversation state persist और manage करता है
  • Cron Scheduler — Scheduled jobs और heartbeat wakeups run करता है
  • Plugin Runtime — Plugin lifecycle load और manage करता है
  • Browser Service — Web automation के लिए Chromium instances control करता है
  • Binding Modes

    | Mode | विवरण | |------|-------------| | Loopback | Default। केवल localhost (127.0.0.1) से accessible | | LAN | आपके local network पर accessible। Bonjour/mDNS के माध्यम से Auto-discoverable | | Tailnet | MagicDNS के साथ Tailscale VPN के माध्यम से accessible | | Custom | एक specific address पर Bind करें |

    Authentication

    | Method | विवरण | |--------|-------------| | Token | WebSocket bearer token (UUID या custom string) | | Password | Password-based auth (bcrypt hashed) | | Trusted Proxy | Pre-auth headers वाले reverse proxies के लिए | | Local Trust | Loopback connections auto-approved |

    Configuration

    Gateway openclaw.json (JSON5 format) के माध्यम से configure होता है। Key sections:

    | Section | Controls | |---------|----------| | agents | Agent list, defaults, workspaces | | gateway | Port, bind mode, auth, reload behavior | | channels | Per-channel config और credentials | | tools | Tool permissions, profiles, security | | plugins | Plugin loading, enabling, per-plugin config | | models | Provider auth, fallbacks, provider settings | | skills | Skill directories, per-skill configuration | | browser | Browser profiles, ports, headless mode | | cron | Scheduler configuration | | session | Reset rules, compaction thresholds | | messages | TTS settings, media policies | | memory | Memory indexing configuration | | security | Sandboxing, elevated mode, approvals |

    Hot Reload

    Configuration changes बिना restart किए apply की जा सकती हैं:

    | Mode | Behavior | |------|----------| | Hybrid (default) | Safe changes hot-apply करें, बाकियों के लिए restart | | Hot | केवल hot-safe changes apply करें, बाकियों को ignore करें | | Restart | किसी भी reload-required change पर restart | | Off | कोई automatic reload नहीं |

    Remote Access

    Tailscale (Recommended)

    Tailscale secure, zero-config remote access provide करता है:

  • Gateway को आपके Tailnet से bind करें
  • Same Tailscale network पर किसी भी device से access करें
  • MagicDNS के माध्यम से Automatic DNS
  • Tailscale Serve HTTPS के साथ dashboard expose कर सकता है
  • SSH Tunnel

    SSH के माध्यम से Gateway port forward करें:

  • Simple, secure, कोई configuration changes आवश्यक नहीं
  • किसी भी SSH-capable machine के साथ काम करता है
  • Full WebSocket protocol और Control UI support करता है
  • Security Rules

  • Loopback + SSH/Tailscale सबसे safe combination है
  • Non-loopback binding को auth token configuration आवश्यक है
  • Extra security के लिए TLS fingerprint pinning उपलब्ध है
  • Browser control default रूप से remote connections के लिए disabled है
  • Health Monitoring

    Health Endpoint

    /health HTTP endpoint return करता है:

  • Gateway status
  • RPC liveness
  • Per-channel health (connected, auth status, account count)
  • Browser readiness
  • Active agents और connected nodes
  • Uptime
  • Probes

  • RPC liveness — WebSocket connect + echo test
  • Channel health — Auth check + API ping per channel
  • Browser readiness — Port check, process check
  • Node connectivity — Last heartbeat timestamp
  • Discovery

    Bonjour/mDNS

    LAN से bound होने पर, Gateway multicast DNS के माध्यम से खुद को advertise करता है:

  • Service type: _openclaw-gw._tcp
  • Port, transport, TLS status, और Tailscale DNS info शामिल है
  • Companion apps automatically Gateway discover करते हैं
  • Wide-Area Discovery

    Configurable timeouts के साथ अपने network में gateways discover करें। Local Bonjour और Tailscale DNS discovery दोनों support करता है।

    Multiple Gateways

    आप profiles का उपयोग करके same machine पर multiple Gateway instances run कर सकते हैं:

  • प्रत्येक profile का separate config, workspace, sessions, और state है
  • प्रत्येक Gateway के लिए different ports
  • Isolation (personal vs work) या testing के लिए useful
  • Diagnostics

    Doctor

    Built-in diagnostic tool check करता है:

  • Configuration validity
  • File permissions
  • Channel connectivity
  • Model auth status
  • Node.js version compatibility
  • Common misconfigurations
  • यह permission दिए जाने पर कई issues automatically fix कर सकता है।

    Logging

    Gateway logs daily JSONL files में लिखे जाते हैं:

  • Per-completion token usage tracking
  • Channel event logs
  • Structured context के साथ Error logging
  • Configurable log levels
  • View full documentation