Skip to content

Publish and Subscribe to Realtime Data on Vercel

Realtime communication allows events to be streamed directly to your application by maintaining a single connection. WebSockets enable online experiences like collaborative document editing, multiplayer games, and interactive chatrooms.

The two main approaches to apply this model to stateless serverless functions are:

  1. Serverless Functions have maximum execution limits and should respond as quickly as possible. They should not subscribe to data events. Instead, we need a client that subscribes to data events and a serverless function that publishes new data. Consider using one of the providers below to implement this approach.
  2. Rather than pushing data, you can fetch realtime data on-demand. For example, the Vercel dashboard delivers realtime updates using SWR.

These providers can help you integrate realtime communication into your Vercel application using Serverless Functions.

Couldn't find the guide you need?