PRO

WebSocket Route Handler

Native WebSocket upgrade support in a Next.js route handler via NextResponse.upgrade(), powered by crossws (bundled with Next.js, no extra install). Requires the experimental.webSocketRouteHandlers flag in next.config.ts; Node.js runtime only, not supported on Edge, static export, or Vercel Functions.

Install
npx shadcn@latest add @compronents/websocket-route-handler

Installs from ui.aryank.space. Needs a registry token and a one-time @compronents entry in components.json. The docs walk through both.

Visualization
upgrade
Request
socket
unknown
return NextResponse.upgrade({ open(peer) { peer.send(welcome) } })

A Next.js route handler upgrades to WebSocket via NextResponse.upgrade() on the Node runtime, powered by the bundled crossws, no extra install.

Files
Checking access…
Dependencies
None.