Predict.aiDocs
Realtime

Realtime

Live events over WebSockets — trainings, deployments, forecasts, and goal alerts, without polling.

The realtime gateway pushes JSON events to you over a single WebSocket as things happen: a training completes, a deployment goes live, a forecast lands, a goal alert fires. Subscribe to the channels you care about and stop polling.

wss://<your-base-url>/v1/ws

Delivery is best-effort — REST remains the source of truth. If your connection drops, missed events are not replayed; re-fetch state via REST after you reconnect.

Thirty seconds of WebSocket

Connect with your token, subscribe to a workspace channel, and events start flowing (> is what you send, < is what you receive):

wscat -c "wss://api.predict.ai/v1/ws?access_token=$TOKEN"
< {"type": "welcome", "connection_id": "9a1b2c3d4e5f...", "user_id": "USER_ID", "cell": "eu-1", "ts": "2026-07-15T12:00:00+00:00"}
> {"action": "subscribe", "channel": "workspace:WORKSPACE_ID", "id": "c1"}
< {"type": "ack", "action": "subscribe", "channel": "workspace:WORKSPACE_ID", "id": "c1"}
< {"type": "event", "channel": "workspace:WORKSPACE_ID", "event": "training.job.completed", "data": {"training_id": "TRAINING_ID", "model_id": "MODEL_ID", "status": "completed"}, "ts": "2026-07-15T12:03:41+00:00"}

When to use what

You wantUse
Live, structured events (training progress, deployment status, goal alerts) across one or more channelsThis gateway
The current state of a resource, or to reconcile after a disconnectREST — always the source of truth
Just your in-app notification feed (the bell) as a streamThe notifications SSE feed — simpler if notifications are all you need

In this section

On this page