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.

There are two main approaches to apply this model to stateless serverless functions.

  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.

Providers

These providers can help you integrate realtime communication into your Jamstack application using serverless functions.

Related

For more information on what to do next, we recommend the following articles:


Last Edited on April 15th 2021