Reference

Realtime

Live network stats over Socket.IO — one room, two events.

Pluid pushes live network telemetry over a Socket.IO connection. On connect you join the global room and receive a steady stream of slot, TPS, epoch, and priority-fee snapshots — the same payload as the /api/v1/network route.

Connecting

The transport is Socket.IO at path /socket.io with WebSocket (falling back to polling). Clients are placed in the global room automatically.

socket.tsts
import { io } from "socket.io-client";

const socket = io("https://pluid.net", {
  path: "/socket.io",
  transports: ["websocket", "polling"],
  reconnection: true,
});

socket.on("stats", (s) => console.log("slot", s.slot, "tps", s.tps));

Rooms

  • global — joined on connect. Carries network-wide stats snapshots. No subscribe call is needed.

Events

stats

Emitted on a short interval to the global room.

FieldTypeDescription
slotnumberLatest processed slot.
tpsnumberTransactions per second.
epochnumberCurrent epoch.
epochProgressnumberFraction through the epoch (0–1).
priorityFeenumberRecent prioritization-fee estimate.
tsepoch msWhen the snapshot was produced.
json
{
  "slot": 296410233,
  "tps": 3412,
  "epoch": 686,
  "epochProgress": 0.4123,
  "priorityFee": 12500,
  "ts": 1718900000000
}

upstream:status

Connection health for the mesh feed behind the socket.

json
{ "status": "connected" }   // or "reconnecting"

The React Hook

Inside the app, useGlobalStats wraps the singleton socket and exposes the latest snapshot plus a connection status. The component must be a client component.

LiveSlot.tsxtsx
"use client";
import { useGlobalStats } from "@/lib/realtime/client";

export function LiveSlot() {
  const { stats, status } = useGlobalStats();
  if (!stats) return <span>connecting…</span>;
  return (
    <span className="tnum">
      slot {stats.slot} · {stats.tps} tps · {status}
    </span>
  );
}
ReturnsTypeDescription
statsGlobalStats | nullLatest stats snapshot, or null before the first event.
statusstringconnecting, connected, or reconnecting.
Realtime, not historical
The socket is for live telemetry. For point-in-time or historical reads — with receipts — use the REST API.