Private channel

Background Job Results

Imports, exports, payments, and other long-running work often finish while the user is still being redirected. A cache channel keeps the last event, so the browser gets the result as soon as it subscribes, with no polling and no extra key-value store to bridge the gap.

Implementation

example.js
// Server: the job finishes, maybe before the browser has subscribed
await apinator.trigger({
  name: 'job-finished',
  channel: `private-cache-job-${jobId}`,
  data: JSON.stringify({ status: 'done', imported: 1200 })
})

// Client, after the redirect: gets the cached result even if the job already finished
const job = client.connect().subscribe(`private-cache-job-${jobId}`)

job.bind('job-finished', (data) => showResult(data))

Why Apinator for background job results

Cache channels deliver the last event to clients that subscribe late
Private cache channels keep each job result visible only to its owner
Publish from the worker that ran the job, in Node.js, Python, Go, or PHP
No polling loop and no separate store to hold results until the page loads
Cached events expire 30 minutes after the last publish
Keep a status endpoint as a fallback for results older than the cache

Ready to build background job results?

Get started in minutes. Completely free, no credit card required.