@domvia/realtime-chat
Private chat rooms
Model room messages, typing state, read receipts, presence, and encrypted payload decisions without turning the core SDK into a messy all-in-one package.
Public documentation
Learn how DomVia Realtime apps, keys, origins, channels, usage limits, gateway status, and security events fit together. Start small, protect sensitive flows, then scale into production operations.
Create your first realtime app, add trusted origins, copy your public key, and connect your client.
Understand how apps, regions, environments, limits, endpoints, and app IDs work together.
Learn the difference between public keys, secret keys, secret previews, and safe rotation.
Protect realtime traffic with trusted origins, signed channel authorization, usage limits, and alerts.
Setup path
4 steps
App, origins, keys, channels
Credential model
Public + secret
Safe split for clients and servers
Protection
Origin + auth
Guarded joins and usage limits
SDK guides
Keep the public docs clean. Each SDK guide gives a short preview here, then opens into a focused full page when the developer wants implementation depth.
Controlled dynamic design
The SDK can grow into messaging, Uber-like location, delivery timelines, WhatsApp-like call signaling, presence, and private encryption without becoming one huge package. Core realtime stays stable; feature packages stay focused.
@domvia/realtime-chat
Model room messages, typing state, read receipts, presence, and encrypted payload decisions without turning the core SDK into a messy all-in-one package.
@domvia/realtime-location
Send controlled, short-lived location updates for trips, same-day deliveries, inspectors, drivers, couriers, and field workers.
@domvia/realtime-delivery
Track pickup, in-transit, nearby, delivered, failed, and support-needed states with realtime visibility for customer and operator screens.
@domvia/realtime-calls
Coordinate WhatsApp-like audio and video call state with ringing, accept, reject, end, WebRTC offer, answer, ICE candidate, and media state events.
@domvia/realtime-e2ee
Use end-to-end encryption where the content must stay private. Keep it focused on private chat payloads instead of forcing every realtime event to be encrypted.
Getting started
This is the safest first path for connecting a new app. Create the app, trust your website origin, use the public key on the client, and keep private authorization inside trusted server code.
Step 01
An app is an isolated realtime project. It has its own app ID, public key, secret preview, allowed origins, region, environment, and limits.
Step 02
Allowed origins tell DomVia Realtime which websites are allowed to connect. Add your production domain before real users connect.
Step 03
The public key is safe for browser, mobile, and client SDK setup. It identifies the app that should receive the realtime connection.
Step 04
For private and presence channels, your trusted server route should verify the user and return a signed authorization response.
Apps
A realtime app is the main container for credentials, origins, channel access, limits, and environment settings.
| Concept | Meaning |
|---|---|
| App ID | A stable identifier for one realtime app inside your workspace. |
| Environment | A label such as production, staging, or development. |
| Region | The preferred operating region for a realtime app. |
| Endpoint | The public gateway host your app connects to. |
| Origins | Trusted websites allowed to connect to an app. |
| Limits | Plan and app-level usage boundaries for safe scaling. |
Recommended setup
✓ One app per product environment.
✓ Separate production and staging keys.
✓ Trusted origins per app.
✓ Private channels for sensitive rooms.
✓ Presence only where online users matter.
✓ Security events reviewed regularly.
Credentials
Keys are the most important part of your setup. Public keys identify apps. Secret keys sign protected actions and must stay private.
Use this in browser, mobile, and client SDK setup. It identifies your realtime app.
Keep this in trusted server code only. Never place it in browser or mobile apps.
A masked hint that helps identify a secret without revealing the full value.
Generate a new key, copy the secret once, update your trusted server, then revoke the old key.
Secret key rule
The full secret should only be shown once after creation. Copy it, store it safely, and use it only from trusted server code.
sk_live_••••••••••••••••••••
Secret preview helps identify a secret without revealing the full value.
Realtime channels
Channels are realtime rooms. Choose the right channel type based on whether the data is public, protected, or needs online member visibility.
Good for open events where users do not need special permission to listen.
public-feed.global
Good for messages, private dashboards, account events, order updates, and user-specific rooms.
private-chat.room.42
Good for online members, active viewers, live collaboration, delivery rooms, and team activity.
presence-order.884
✓ Client requests access to a private or presence channel.
✓ Trusted server verifies the signed-in user.
✓ Trusted server signs the channel authorization response.
✓ Client joins the protected channel through the realtime gateway.
trusted-server-route.ts
import { authorizePrivateChannel } from "@domvia/realtime-server";
app.post("/realtime/auth", async (request, response) => {
const user = await requireSignedInUser(request);
const channelName = request.body.channel_name;
if (!user.canJoin(channelName)) {
return response.status(403).json({ message: "Forbidden" });
}
return response.json(
await authorizePrivateChannel({
key: process.env.DOMVIA_REALTIME_KEY,
secret: process.env.DOMVIA_REALTIME_SECRET,
socketId: request.body.socket_id,
channelName,
}),
);
});Production safety
Security is not one switch. It is a full workflow: safe keys, trusted origins, signed private access, usage limits, security events, and alerts.
✓ Use public keys in browser and mobile apps only.
✓ Keep secret keys inside trusted server code only.
✓ Add trusted origins before production traffic.
✓ Use private channels for sensitive conversations and account data.
✓ Use presence channels only when online member visibility is needed.
✓ Rotate credentials if a secret may have been exposed.
✓ Review blocked gateway activity from Security Center.
✓ Keep usage limits enabled to protect apps from unexpected traffic.
Fix issues faster
Most realtime issues come from wrong keys, blocked origins, missing channel authorization, or usage limits.
Problem
Likely cause
The public key may be wrong, the app may be disabled, or the gateway host may be incorrect.
Fix
Check the app keys page, app status, and gateway value shown in the console.
Problem
Likely cause
The website trying to connect is not listed as a trusted origin for that app.
Fix
Open the app, add the exact website origin, then retry the connection.
Problem
Likely cause
The channel authorization response may be missing, invalid, or signed with the wrong secret.
Fix
Check your trusted server route, socket ID, channel name, and active secret key.
Problem
Likely cause
Presence channels require valid channel data with user information.
Fix
Return signed authorization with valid user data for the connected member.
Problem
Likely cause
The app has reached the monthly event or message limit for the current plan.
Fix
Review usage, reduce traffic, or upgrade the workspace plan when billing is ready.
Reference
These are the main API areas your console uses. Protected workspace endpoints require an authenticated console token.
| Area | Use | Endpoint |
|---|---|---|
| Health | Check platform API health. | GET /api/health |
| Plans | Load public plan limits and pricing data. | GET /api/plans |
| Workspace | Load the current workspace and plan. | GET /api/workspaces/current |
| Apps | List realtime apps in the workspace. | GET /api/realtime/apps |
| Keys | List keys for one realtime app. | GET /api/realtime/apps/{app}/keys |
| Origins | List trusted origins for one app. | GET /api/realtime/apps/{app}/origins |
| Security events | Review blocked gateway activity. | GET /api/realtime/security-events |
| Gateway status | Check current gateway reachability. | GET /api/realtime/gateway/status |
FAQ
Yes. Client apps need a public realtime gateway to connect. Security comes from app credentials, trusted origins, signed private channel authorization, rate limits, and security monitoring.
Yes. Public keys are designed for browser, mobile, and client SDK setup.
No. Secret keys must stay in trusted server code. They should never be shipped inside browser or mobile apps.
Use private channels when the realtime data belongs to a specific user, account, conversation, order, tenant group, team, or workspace.
Use presence when your app needs to show who is online inside a room, order, conversation, workspace, or collaborative screen.
Next docs to add
Keep the public docs educational. Add deeper examples through focused guides, not heavy dashboard cards.
○ React quick-start
○ React Native quick-start
○ Flutter quick-start
○ Server authorization package
○ Calls signaling guide
○ Key rotation guide
○ Status monitoring guide
○ Optional E2EE guide