← Back to all frameworks MERN + API

WebSockets + Webhooks

Realtime + event-driven — the backbone of modern apps

What it is

WebSockets for bidirectional realtime (chat, typing indicators, live dashboards); webhooks for receiving events from third-party SaaS (Stripe paid, HubSpot updated, Slack mention).

How Vaaani uses it

  • Streaming LLM tokens to the chat UI as they generate
  • Live agent status: 'agent is thinking → calling tool → responding'
  • Webhook receivers turning Stripe events into AI-driven follow-ups
  • Realtime dashboard updates without polling

Why it makes the cut

Polling wastes bandwidth and feels slow. Realtime UIs feel magic — and they're cheap with Socket.io or native WebSockets.

Sample code

import { Server } from "socket.io";

const io = new Server(httpServer);

io.on("connection", socket => {
  socket.on("chat", async q => {
    for await (const tok of streamLLM(q))
      socket.emit("token", tok);
  });
});

Related in the Vaaani stack

Have a project that needs WebSockets?

30-min discovery call. You describe the busywork; I map it to an AI worker and a budget.