FeaturesGuidesDocumentationPricingGet Started

WebSocket Through a LocalToLink Tunnel

LocalToLink supports bidirectional WebSocket passthrough for HMR, chat apps, and real-time APIs.

WebSocket support in v1.0

LocalToLink forwards WebSocket upgrade requests bidirectionally. Your local app handles the WebSocket protocol — the tunnel transports frames transparently.

npx localtolink --port 3000

Connect clients to:

wss://YOUR-SUBDOMAIN.localtolink.com/ws

The CLI also prints websocketUrl in --json output.

Common use cases

| Use case | Notes | |----------|-------| | Vite HMR | Configure hmr.protocol: "wss" — see Vite guide | | Next.js Fast Refresh | Works with allowedDevOrigins — see Next.js guide | | Chat / real-time apps | Connect to wss:// tunnel URL from browser or client | | Twilio Media Streams | Twilio connects via WebSocket to your handler |

Client connection example

const ws = new WebSocket("wss://k7m2x9p4q1.localtolink.com/ws");

ws.onopen = () => ws.send("hello");
ws.onmessage = (event) => console.log(event.data);

Ensure your local server handles WebSocket upgrades on the same port LocalToLink forwards to.

Browser interstitial

WebSocket connections from browsers may require clicking through the interstitial first in a regular browser tab. Once bypassed via cookie, WebSocket connections on that subdomain proceed normally.

Programmatic WebSocket clients (not using the browser interstitial flow) connect directly.

Limits

What is not supported

Try it now

Start a tunnel from your project directory — no account required.

$ npx localtolink

See the full CLI reference for flags and exit codes.

LocalToLink CLI 1.0.1 — verified 2026-09-05