Skip to main content

Realtime Events

Nexio supports real-time event delivery via Pusher for applications that need live updates — for example, showing evaluation progress in a dashboard UI.
Realtime events via Pusher are designed for browser-based applications. For server-to-server integrations, webhooks (webhook_url on job submission) are the recommended approach.

How It Works

When an evaluation completes, Nexio triggers an event on a Pusher private channel scoped to your organization. Your frontend subscribes to this channel and receives events in real time.
Submit job → API queues job → Worker processes → Worker triggers Pusher event

                                              Your browser receives event

Channel Structure

Nexio uses private Pusher channels — they require authentication before subscribing. The channel name format is:
private-org-{org_id}
Your org_id is shown in the dashboard under Settings → Organization.

Setting Up Pusher

1. Install the Pusher JS client

npm install pusher-js

2. Authenticate the channel

Private channels require a channel authorization step. Your application backend must provide a Pusher auth endpoint. You can use the Nexio dashboard’s built-in auth endpoint, or implement your own using your WorkOS session. Refer to the Pusher documentation for setting up channel authorization.

3. Subscribe and listen

import Pusher from "pusher-js"

const pusher = new Pusher("YOUR_PUSHER_KEY", {
  cluster: "YOUR_PUSHER_CLUSTER",
  authEndpoint: "/api/pusher/auth", // your auth endpoint
})

// Subscribe to your org's private channel
const channel = pusher.subscribe("private-org-YOUR_ORG_ID")

// Listen for evaluation completion events
channel.bind("evaluation.completed", (data: EvaluationResult) => {
  console.log("Evaluation complete:", data.eval_id)
  console.log("Top candidate:", data.candidates[0])
})

// Listen for evaluation failure events
channel.bind("evaluation.failed", (data: { eval_id: string; error: string }) => {
  console.error("Evaluation failed:", data.eval_id, data.error)
})

// Clean up on unmount
function cleanup() {
  channel.unbind_all()
  pusher.unsubscribe("private-org-YOUR_ORG_ID")
  pusher.disconnect()
}

Event Schema

evaluation.completed

Fired when an evaluation finishes successfully.
{
  "eval_id": "eval_7xKp2mNc",
  "status": "completed",
  "pool_size": 1847,
  "filtered": 53,
  "candidates": [
    {
      "tier": "STRONG_FIT",
      "name": "Hartford Financial",
      "confidence": "HIGH",
      "scores": {
        "appetite": "L1",
        "coverage": "L2",
        "financial": "L1",
        "pricing": "L1",
        "placement": "L1",
        "service": "L2"
      },
      "reasoning": "Strong CA prof. liability appetite, $10–15M band..."
    }
  ],
  "audit": "https://api.usenexio.com/traces/eval_7xKp2mNc"
}

evaluation.failed

Fired when an evaluation fails to process.
{
  "eval_id": "eval_7xKp2mNc",
  "status": "failed",
  "error": "Invalid pool identifier"
}

React Example

Here’s a minimal React hook pattern for subscribing to evaluation events:
TypeScript
import { useEffect } from "react"
import Pusher from "pusher-js"

function useEvaluationUpdates(orgId: string, onComplete: (data: unknown) => void) {
  useEffect(() => {
    const pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_KEY!, {
      cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER!,
      authEndpoint: "/api/pusher/auth",
    })

    const channel = pusher.subscribe(`private-org-${orgId}`)
    channel.bind("evaluation.completed", onComplete)

    return () => {
      channel.unbind("evaluation.completed", onComplete)
      pusher.unsubscribe(`private-org-${orgId}`)
      pusher.disconnect()
    }
  }, [orgId, onComplete])
}
Always unbind event listeners and disconnect Pusher when your component unmounts to avoid memory leaks and duplicate event delivery.

Pusher Configuration

You’ll need Pusher credentials from the dashboard to connect. These are available under Settings → Integrations → Pusher in platform.usenexio.com.
VariableDescription
PUSHER_KEYYour Pusher app key
PUSHER_CLUSTERYour Pusher cluster (e.g., us2)