Skip to main content

Metered Realtime Messaging

Bi-directional, low-latency messaging over WebSockets. One protocol covers WebRTC signalling, AI agent communication, live presence and chat, IoT telemetry, and collaborative applications.

your client  ⇄  Metered Realtime Messaging  ⇄  your client / your backend
Two ways to use it

Using JavaScript or TypeScript? Start with the @metered-ca/peer SDK — it handles framing, ack correlation, reconnect, perfect-negotiation WebRTC, and TURN injection for you. Most JS apps ship in ~30 lines of code.

Using any other stack (Go, Python, Java, Swift, Kotlin, Rust, Unity), or want the underlying details? The Protocol Reference and Use Case Guides below cover the raw WebSocket path. The SDK and raw-WS clients interoperate.

What it gives you

  • Channels — publish/subscribe with wildcard routing (app_xyz/*, room-*)
  • Direct messages — peer-to-peer send by peerId, no channel required
  • Presence — automatic join/leave events with optional per-peer metadata (userId, username, profilePic, anything you want)
  • JWT-minted credentials — your backend authorizes who can do what, for how long
  • REST API — mint tokens, list peers, server-side publish, kick peers, read usage
  • Built-in TURN integration — embed Metered TURN credentials in the JWT and your peers get them at connect time

Five things you can build with it

Use caseWhy this fits
WebRTC signallingSDP / ICE exchange + automatic TURN credentials in the same connection
AI agent communicationMulti-agent coordination, agent-to-user streams, tool-call relays
Live presence & chatClassroom, proctoring, livestream chat — built-in presence + metadata
IoT telemetry & controlCamera events, vehicle telematics, device commands — MQTT-style pub/sub over WS
Collaborative appsCursors, live dashboards, shared editing state

Each of these has a dedicated Use Case Guide with end-to-end code.

How it relates to other Metered products

  • TURN Server — for WebRTC media relay. Realtime Messaging is the signalling layer that goes with TURN; one Metered account can use both, and your sk_ key can mint connect-tokens that ship TURN credentials inline.
  • Global Cloud SFU — for selective forwarding of media streams. Realtime Messaging is the signalling + control plane; the SFU is the media plane.
  • Video SDK — wraps both above for high-level video-call UX. Use Realtime Messaging directly when you want lower-level control over the wire protocol.

Where to start