Architecture

Browser Widget
no token
←→
Proxy Server
:3100 · injects token
←→
GoClaw Gateway
validates token

How It Works

1 Widget connects to proxy via WebSocket at ws://localhost:3100/ws
2 Widget sends a connect frame (no token)
3 Proxy intercepts the frame, injects GOCLAW_TOKEN from env, forwards to gateway
4 All subsequent frames are relayed transparently
5 Proxy strips any token fields from upstream responses (defense in depth)

Setup

# 1. Configure the proxy server
cd server/
cp .env.example .env
# Edit .env: set GOCLAW_URL and GOCLAW_TOKEN

# 2. Install deps & start the proxy
npm install
npm run dev

# 3. Build the widget (from project root)
cd ..
npm run build

# 4. Open this page in a browser

Client Code

GoClaw.init({
  url: 'ws://localhost:3100/ws',   // proxy server — no token needed!
  title: 'Chat with us',
  theme: 'auto',
});