These serverless functions broadcast quiz events via AnyCable. Copy the folder for your platform into your project.
| Variable | Description |
|---|---|
ANYCABLE_BROADCAST_URL |
AnyCable HTTP broadcast endpoint (from AnyCable Plus dashboard) |
Never put this in your code. Set it in your platform's dashboard.
- Copy
functions/netlify/*.mts(notpackage.json) tonetlify/functions/in your project - Add the runtime dependencies to your project:
npm install @anycable/serverless-js valibot - Set env vars in Netlify dashboard > Site settings > Environment variables
- Deploy — endpoints are
/.netlify/functions/quiz-answerand/.netlify/functions/quiz-sync(the defaults)
- Copy
functions/vercel/*.ts(notpackage.json) toapi/in your project - Add the runtime dependencies to your project:
npm install @anycable/serverless-js valibot - Set env vars in Vercel dashboard > Settings > Environment Variables
- For Slidev, add a
vercel.jsonwith{"buildCommand": "npx slidev build", "outputDirectory": "dist"} - Deploy — endpoints are
/api/quiz-answerand/api/quiz-sync - Configure the plugin to use Vercel endpoints:
slideQuiz: {
endpoints: {
answer: '/api/quiz-answer',
sync: '/api/quiz-sync',
}
}npx -p create-slide-quiz verify-slide-quiz --site https://your-site --platform vercel --ws-url wss://your-cable/cable (from the create-slide-quiz package) checks the audience page, both functions, and a real broadcast round trip over the WebSocket. Run it after every deploy that touches the functions.