Skip to Content
Aperture
REST API

Realtime

Receive live execution updates over a Phoenix Channels websocket.

The dashboard gets live execution updates from a Phoenix Channels websocket. You can subscribe from your own browser app with the phoenix npm package.

Connect

  • URL: wss://<api host>/socket (the transport path is /socket/websocket).
  • Authentication: a login token (from /signin). Personal API keys and project keys are refused.
  • Browsers can only connect from the dashboard's origin.
import { Socket } from 'phoenix';

const socket = new Socket('wss://aperture-server.mountaindev.com/socket', {
  authToken: loginJwt,
});
socket.connect();

Subscribe to a job

Join job_execution:<job_id>. Any member of the job's team can join; others get {"reason": "unauthorized"}. The channel only sends; it ignores messages from the client.

const channel = socket.channel(`job_execution:${jobId}`);
channel.on('scheduled', (execution) => console.log('new run', execution));
channel.on('updated', (change) => console.log('run changed', change));
channel.join();

Events

EventPayloadWhen
scheduledid, status: "scheduled", scheduled_time, log_url: null, duration: null, inserted_at, updated_atA run is created.
updatedid, name, status: "running"A run starts.
updatedid, name, status: "success" | "fail", error_code, log_url, durationA run finishes.
updatedid, status: "cancelled"A run is cancelled.
updatedid, name, status: "missed"A cron run was missed.
updatedid, name, status: "fail", error_code: "orphaned"A run was orphaned.

updated payloads are partial: merge them into the execution with the same id.

On this page