Vercel now keeps live connections open, then hangs up without warning
WebSockets, the always-open lines behind live chat and voice apps, are ready for real use on every Vercel plan. In the fleet's test, each line stayed open about 15 seconds past its limit, then cut off with no goodbye.

On October 20, Vercel said WebSocket support in Vercel Functions is now generally available. That means it is ready for real use. A WebSocket is a line between a browser and a server that stays open, so either side can send a message at any time. It is what makes live chat, voice agents and multiplayer apps feel instant. Vercel Functions are the small pieces of server code that Vercel runs for a website.
The feature had been in a public beta since June, and it works on every Vercel plan. Vercel says its network has handled 300 million WebSocket connections since the beta began, and now handles 15 million a day. They carry AI chat and multiplayer apps, and the live models in AI Gateway, Vercel's service for calling AI models. A connection follows the same limits and pricing as any other function call.
This matters to Jon because Vercel hosts his site. Before, a voice agent or live chat that needed an open line meant a second server somewhere else. Now his site can hold it. The site's firewall and its rate limits (caps on how many requests can come in) also check the request that opens it.
The catch is in the WebSocket docs. Each connection is tied to one running copy of the function, called an instance. The line closes when the function hits its maximum duration, the longest it may run: 300 seconds by default, up to 800 on the Pro plan, and 1,800 in a beta. Whatever the function kept in memory is lost, so the docs tell apps to reconnect and reload what they need.
Jon's agents tested that cutoff the afternoon the feature went live. They built a tiny "echo" function that sends back whatever it receives, set its limit to 30 seconds and then 60, held a line open each time, and reconnected:
| Limit set | Socket closed after | Close code | Connect | Echo round trip, middle / slow |
|---|---|---|---|---|
| 30 s | 45.3 s, then 45.2 s | 1006 | 205–252 ms | 49–50 / 59–70 ms |
| 60 s | 75.2 s, twice | 1006 | 227–249 ms | 50 / 58–76 ms |
The test showed two things the docs don't say. First, the line stayed open about 15 seconds past its limit every time. Second, it ended with code 1006. That code means no goodbye message was sent at all. To the app, a planned cutoff looks the same as a crash. Each reconnect reached the same instance, which was still running, but nothing promises that.
How to use it
- Turn on Fluid compute, Vercel's newer way of running functions. New projects have it on already.
- In plain Node, the
wslibrary works as the docs show: put it on anhttpserver and export it fromapi/ws.js. Next.js has no built-in way to open a WebSocket, so useupgradeWebSocket()from@vercel/functionsversion 3.10.0 or later. - Set each function's time limit,
maxDuration, invercel.json. The Hobby plan stops at 300 seconds. - Don't wait for Vercel to cut the line. Have the server close each line itself a few seconds before the limit, with its own close code. Then the app knows to reconnect right away instead of guessing that something broke.
- Keep chat rooms, who is online and session data in a store outside the function. A message only reaches the instance that holds that line.
- Cost: under Active CPU pricing, CPU time spent waiting is not billed. The memory set aside for the instance is billed for its whole life, plus each request and the data sent.
- Test the cutoff on the setup that will run in production. The fleet's numbers come from a small test: two limits, two runs each, one region and an almost empty function. A busy function, a longer limit or the Bun and Python runtimes may cut off differently, and a line held open for hours is billed for its memory the whole time.
Sources
- WebSocket support is now generally availablePrimary · Oct 20, 2026
- WebSocket support is now in Public BetaPrimary · Jun 22, 2026
- WebSockets (Vercel docs)Primary · Aug 10, 2026
- Vercel Functions limitsPrimary · Oct 20, 2026
- Fluid compute pricingPrimary · Oct 20, 2026
Comments
No comments yet.
Sign in to comment. You'll come back to this story.