# SilentCronX Live Demo

This demo uses only Node.js built-in HTTP APIs and the local SilentCronX build. No Express, no React dependency, and no extra runtime library is required.

## Run

```bash
npm run build
node examples/live-demo/server.mjs
```

Open:

- `http://localhost:4517`
- `http://localhost:4517/health`
- `http://localhost:4517/jobs`
- `http://localhost:4517/queues/stats`
- `http://localhost:4517/events`
- `http://localhost:4517/events/stream`

Trigger a job:

```bash
curl -X POST http://localhost:4517/jobs/report \
  -H "Content-Type: application/json" \
  -d "{\"reportType\":\"daily\"}"
```

## ReactJS Connection Example

```tsx
import { createSilentCronXClient } from "silent-cronx";

async function sendReportJob() {
  const client = createSilentCronXClient({ baseUrl: "http://localhost:4517" });
  return client.triggerJob("report", {
    payload: { reportType: "daily" },
    priority: 10,
  });
}
```

## React Native Connection Example

```tsx
import { createSilentCronXClient } from "silent-cronx";

async function sendMobileReportJob() {
  const client = createSilentCronXClient({ baseUrl: "http://localhost:4517" });
  return client.triggerJob("report", {
    payload: { reportType: "mobile-daily" },
  });
}
```

## Progress and Events

The demo stores latest job progress on each job record. Use:

- `GET /jobs/:jobId` for polling.
- `GET /events` for recent event history.
- `GET /events/stream` for browser-native Server-Sent Events.

SilentCronX stays in Node.js. React, React Native, Android, or any client connects through HTTP APIs.
