PushFlo
+PushFlo

WebSockets for Vercel

Vercel is amazing for deploying Next.js apps, but it can't hold WebSocket connections. PushFlo bridges that gap with managed WebSocket infrastructure.

The Problem: Vercel Can't Hold WebSocket Connections

Vercel's serverless architecture is designed for request-response patterns. Your function receives a request, processes it, returns a response, and shuts down.

WebSockets need a persistent connection. The server must stay alive to receive messages from the client and push messages back. This fundamentally conflicts with the serverless model.

You can't just "add WebSockets" to a Vercel app. You need external infrastructure.

The Solution: PushFlo as Your WebSocket Layer

PushFlo runs persistent WebSocket servers on Cloudflare's global edge network. Your users connect to us, and we handle the connection management.

When you need to send a message, call our REST API from your Vercel function. We instantly deliver it to all connected clients on that channel.

Your Vercel App
PushFlo API
User's Browser

5-Minute Quickstart

Get real-time working in your Next.js app with two code snippets.

1

Install the SDK

Terminalbash
npm install @pushflodev/sdk
2

Subscribe in your React component

app/dashboard/page.tsxtypescript
"use client";
import { useEffect, useState } from 'react';
import { PushFloClient } from '@pushflodev/sdk';

export default function Dashboard() {
  const [messages, setMessages] = useState([]);

  useEffect(() => {
    const client = new PushFloClient({
      publishKey: process.env.NEXT_PUBLIC_PUSHFLO_KEY,
    });

    client.connect();

    const sub = client.subscribe('updates:dashboard', {
      onMessage: (msg) => {
        setMessages((prev) => [...prev, msg.content]);
      },
    });

    return () => {
      sub.unsubscribe();
      client.disconnect();
    };
  }, []);

  return (
    <div>
      {messages.map((msg, i) => (
        <div key={i}>{JSON.stringify(msg)}</div>
      ))}
    </div>
  );
}
3

Publish from your API route

app/api/webhook/route.tstypescript
import { PushFloServer } from '@pushflodev/sdk/server';
import { NextResponse } from 'next/server';

const pushflo = new PushFloServer({
  secretKey: process.env.PUSHFLO_SECRET_KEY,
});

export async function POST(request: Request) {
  const data = await request.json();

  // Process your webhook or business logic
  // ...

  // Push update to all connected clients
  await pushflo.publish('updates:dashboard', {
    type: 'new-order',
    orderId: data.orderId,
    timestamp: Date.now(),
  });

  return NextResponse.json({ success: true });
}

What You Can Build

Real-time features that would otherwise require managing your own WebSocket infrastructure.

Live Notifications

Push notifications to your users instantly. Order updates, new messages, activity alerts.

notifications:user-{userId}

Real-time Dashboards

Stream metrics and analytics to admin dashboards without constant polling.

dashboard:{companyId}

Chat & Messaging

Build real-time chat for customer support, team collaboration, or social features.

chat:room-{roomId}

Live Cursors & Presence

Show where other users are on the page. Great for collaborative tools.

presence:{documentId}

Gaming & Multiplayer

Sync game state across players in real-time for turn-based or casual games.

game:match-{matchId}

Live Updates

Push content updates, price changes, or inventory status without page refresh.

updates:{resourceType}

Why Vercel Developers Choose PushFlo

No Infrastructure to Manage

We handle the WebSocket servers, scaling, and global distribution. You focus on your app.

Works with Edge Functions

Publish messages from Vercel Edge Functions, Serverless Functions, or any HTTP client.

Global Edge Network

Deployed to 300+ cities worldwide. Your users connect to the nearest server automatically.

Simple Pricing

Free tier for development. $19/month for production. No per-connection or per-message fees.

Further Reading

Add real-time to your Vercel app today

Start with our free tier. 500K messages/month. No credit card required.

Switching from Pusher? See our Pusher alternative comparison. Or explore Serverless WebSockets for other platforms.