webhook-over-websocket

A tunnel tool that forwards external webhook requests to a local development server via WebSocket.
Overview
webhook-over-websocket allows you to receive webhooks from external services (e.g. GitHub, Stripe, Slack) on your local development machine without exposing it to the internet directly. It works by establishing a persistent WebSocket connection between a publicly accessible server and the client running locally.
External Service → (HTTP) → Server /webhook/{channel_id}
↕ WebSocket
Client (local machine)
↓ (HTTP)
Local application (e.g. http://localhost:3000)
Architecture
| Component |
Role |
| Server |
Publicly accessible HTTP server. Receives webhooks and forwards them over WebSocket to the connected client. Also exposes a Traefik HTTP Provider endpoint for dynamic routing when running at scale. |
| Client |
Runs on the local machine. Connects to the server via WebSocket, receives webhook payloads, and forwards them to the local application. |
Server Endpoints
| Endpoint |
Description |
GET /new |
Issues a new channel_id (UUID) for a client to use |
GET /traefik-config |
Returns dynamic Traefik routing configuration (HTTP Provider) |
GET /internal/channels |
Returns active channel list (used for peer-to-peer sync in multi-replica deployments) |
GET /ws/{channel_id} |
WebSocket upgrade endpoint for client connections |
POST /webhook/{channel_id}[/...] |
Receives external webhook requests and tunnels them to the client |
Installation
Docker
docker pull ghcr.io/nonchan7720/webhook-over-websocket:latest
Go install
go install github.com/nonchan7720/webhook-over-websocket@latest
Binary download
Download the latest binary for your platform from the Releases page.
Usage
1. Start the server
Run the server on a publicly accessible host:
webhook-over-websocket server --port 8080
Or with Docker:
docker run --rm -p 8080:8080 ghcr.io/nonchan7720/webhook-over-websocket:latest server --port 8080
Server flags:
| Flag |
Default |
Description |
--port, -p |
8080 |
Port to listen on |
2. Start the client
Run the client on your local machine, pointing it at the server and your local application:
webhook-over-websocket client \
--server-url http://your-server.example.com \
--target-url http://localhost:3000
On startup, the client prints the webhook URL to configure in the external service:
Issued Channel ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Please set the webhook destination as follows: http://your-server.example.com/webhook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
A tunnel to the server has been established.
Client flags:
| Flag |
Default |
Description |
--server-url |
(required) |
URL of the webhook-over-websocket server |
--target-url |
http://localhost:3000 |
URL of the local application to forward webhook requests to |
Set the webhook URL in the external service (e.g. GitHub, Stripe) to:
http://your-server.example.com/webhook/<channel_id>
Any path suffix after the channel ID is preserved and forwarded to your local application as-is.
Environment Variables
| Variable |
Description |
POD_IP |
Pod IP address used as the server's own IP (Kubernetes). When set to a valid IPv4 address, it is used instead of auto-detection. |
Scaling Out (Traefik Integration)
When running multiple server replicas (e.g. in Kubernetes), Traefik can be used as a load balancer with dynamic routing so that webhook requests are always forwarded to the replica that holds the correct WebSocket connection.
Configure Traefik's HTTP Provider to poll /traefik-config:
# traefik static configuration
providers:
http:
endpoint: "http://webhook-over-websocket-service/traefik-config"
pollInterval: "5s"
Each server replica advertises its active channels via /internal/channels and aggregates peer information via DNS-based discovery to produce the complete routing configuration.
Development
The repository includes a Docker Compose file for local development:
docker compose up -d
This mounts the repository source into the container so you can edit files locally.