For apps

A WebSocket API with no server to run

A realtime API on hosted WebSockets, for Next.js, Laravel, Django and any other stack. Your server sends an event in one short request, and every page in the room gets it at once. We keep the connections open, so there is no WebSocket server for you to run, scale or restart.

Or try the live demo: a small shop, where an order turns to shipped in another window as you click.

The best pricing for WebSockets. From $11.99 a month for 1,000 concurrent connections, billed yearly, or $14.99 billed monthly.

Your server

Next.js on the server, and React on the page.

app/orders/actions.ts
'use server';

import { realtime } from '@/lib/realtime';

export async function markShipped( id: string ) {
    await saveStatus( id, 'shipped' );
    await realtime.to( `order:${ id }` )
        .emit( 'updated', { status: 'shipped' } );
}
Your app

Hooks and components for any React app, on any of the servers above.

components/Status.jsx
'use client';   // in Next.js

import { useState } from 'react';
import { useRoom } from '@wordplus/realtime/react';

// Inside <RealtimeProvider>, once for the whole app.
export function Status( { id, initial } ) {
    const [ status, setStatus ] = useState( initial );
    useRoom( `order:${ id }`, {
        updated: ( data ) => setStatus( data.status ),
    } );
    return <p>{ status }</p>;
}
An order moving to Shipped, on the shop page and live on the customer page

Hosted

The part you no longer run

A WebSocket server works on your laptop. In production it has to keep every connection open for hours, share each event between machines and survive your deploys, and a serverless host cannot hold a connection at all. Here the connections stay with us, and your server stays as it is.

No websocket servers to keep

Your own websocket server has to hold every connection, grow past one machine and stay up through deploys. The cloud does that, adding servers as your traffic grows, and a page moves to another server without a drop.

Any host for your server

Your server only signs and sends, so it runs anywhere, serverless and edge functions included, which cannot hold a connection open themselves.

Your sign-in stays yours

A user is whatever id your app knows them by, read on your own server, so your session and cookies work as they do now.

Your server decides

Send to anyone, see who is online, and manage your rooms

A room is only a name, such as chat:7, with nothing to create in the cloud. Your database says which rooms exist and who is in them, one rule on your server reads it, and the cloud holds every page to the answer. Here is a team chat, from start to end.

Your server

Next.js on the server, and React on the page.

Create a room

Save it in your database, and write one rule that reads it. The rule runs when someone asks to join: false keeps them out, true lets them in, and readOnly lets them read and send nothing. Here db is your own database, and me is the person signed in.

app/rooms/actions.ts
// A room is a row of yours. Nothing is created in the cloud.
const room = await db.room.create( { data: { name: 'Team' } } );

await db.member.create( { data: { roomId: room.id, userId: me, role: 'member' } } );

// Its name is yours to choose: row 7 is the room chat:7.
lib/realtime.ts
// Once, for every chat. When someone asks to join chat:7, id is '7'.
realtime.room( 'chat:{id}', async ( user, { id } ) => {
    const room = await db.room.findUnique( { where: { id: Number( id ) } } );
    if ( !room || room.closed ) return false;       // no such room, or closed

    const member = await db.member.findFirst( { where: { roomId: room.id, userId: user } } );
    if ( !member || member.banned ) return false;   // not a member, or banned

    return member.role === 'reader' ? { readOnly: true } : true;
}, { presence: true, emit: [ 'message' ] } );

The team chat here is the start of one: the chat API adds the ready-made chat, the history, read ticks, files and moderation.

Rooms in each stack, with the whole setup:

Why websockets get hard in your own framework: Next.js, Laravel, Django and Flask, FastAPI.

Running a WebSocket server of your own? Our WebSocket test checks it from your browser.

On every connection

More than a socket

A socket carries bytes. Everything an app builds around it, from reconnects to who is online, is already there.

The browsers of Ann, Ben and Cara, each listing the three of them in the shop now, with their roles

Nothing lost on a reconnect

A room can keep its last events, and a page that comes back gets what it missed, in order, before what comes next.

Who is online

A room can list who is in it, with what you choose to show of each person. A count says how many are looking at a page, at any size, and who is online is known across your whole app.

Events from the page

Pages send to the rooms they are in, with no request to your server: chat messages, typing, a cursor. The rule says which events may be sent, and a webhook gives your server those it should keep.

To one person, everywhere

Send to a user, and it reaches every tab and device they have open, with no room to set up.

Encrypted, with keys we never hold

Events, presence and history travel sealed with keys your server holds, and calls between two people are encrypted end to end. The cloud carries them without being able to read them.

One connection for every tab

The tabs of a browser share one connection, so a person with three tabs open counts once.

Use cases

What people build on WebSockets

Each is a whole app in the docs, with its server in Node.js, PHP and Python.

Live updates and notifications

An order that moves on its page, a dashboard, the progress of a job, and a notice to one user in every tab and app.

Chat

Conversations between two people and in groups, with typing, read ticks and reactions, kept in your own database.

Who is online and who is here

A dot on every avatar, the people in a room with their roles, and how many look at a page.

Editing together

Who is in a document, their cursors, and the changes, sent as binary and kept for a reconnect.

Polls, quizzes and questions

Votes and questions that reach your server alone, results sent to everyone, and a score for each player.

Live auctions

Bids your server decides one at a time, the new price to everyone, and a clock that moves on a late bid.

Pricing

Priced by connections, never by messages

From $11.99 a month for 1,000 concurrent connections, billed yearly, or $14.99 billed monthly.

Priced by concurrent connections, starting from 1,000, billed monthly or yearly. Messages and bandwidth are never charged, and what your server sends uses none of your connections.

The same plan and SDK bring video calls and live streaming, on the same connection.

Questions

Frequently asked

Do I need my own WebSocket server?

No. Browsers and apps keep their connections open to our servers, and more of them start as your app grows. Your server only says who may join what, and sends each event in one short HTTP request.

Does it work on serverless hosting?

Yes. A serverless function cannot hold a connection open, and here it does not have to: it sends each event in one short request, and the connections stay with us. Edge functions and any other host work the same way.

Which stacks can use the WebSocket API?

Next.js and Express, Laravel and plain PHP, Django, FastAPI and Flask, Capacitor, iOS and Android, each with a guide. React Native and Flutter apps have rooms and presence too. A server in any other language uses the HTTP API.

Do I write the WebSocket code myself?

No. The SDK opens the connection, reconnects by itself and joins your rooms again, and you listen for events by name. In Laravel it is a broadcasting driver, so broadcast() and your channels file stay as they are.

What counts as a connection?

A browser or a device connected to the cloud at that moment. The tabs of one browser share a connection when your app serves the SDK worker, and what your server sends through the API counts none.

What happens at my connection limit?

Up to 20% more still connect, and the account owner gets an email at 80% and at 100% of them, in time to move to a larger plan.

What happens when a page loses its connection?

It reconnects by itself. A room that keeps history gives it what it missed, in order, for up to 5 minutes, and a page away for longer is told, so it can read your server again. History is only for reconnects: your own database keeps your records.

Who decides who joins a room?

Your server, with a rule for each kind of room: who joins, what they may send, and who only reads. The cloud enforces every answer, and your server can take someone out of a room at any moment.

Can you read what my app sends?

Not in a private or presence room. Its events, its history and who is in it travel sealed with keys your server makes, and the cloud carries them without being able to read them. A public room, which anyone may join, goes plain.

Where are your servers?

The realtime servers that carry your events run in Germany. The relays and media servers for calls run in more countries.

Questions about your integration? Write to us: we help with the SDKs, the call screen and your stack.