Skip to content

Do Vercel Serverless Functions support WebSocket connections?

Serverless Functions on Vercel are stateless and have a maximum execution duration. As a result, it is not possible to maintain a WebSocket connection to a Serverless Function.This article provides information on using realtime communication in your app and where you can learn more about how to enable it.

Enabling Realtime Communication

While you cannot maintain a persistent connection to a Serverless Function, it is possible to use a third-party service, such as Pusher Channels, to enable realtime communication for your app.When using a third-party service it is important to keep in mind that the client should be used to subscribe to events, while all publishing should be handled by a Serverless Function.

Further Resources

For more information on using realtime communication in your app, you can take a look at the following resources:

Couldn't find the guide you need?