How to triage SSE event divergence in the reservations service.
Scanned 9/22/2026
Install to Claude Code
npx -y skills add mattbutlerengineering/mattbutlerengineering --skill sse-event-debug --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Sse Event Debug?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/mattbutlerengineering-sse-event-debug)More formats (shields.io, HTML) on the badges page.
# Skill: sse-event-debug
How to triage SSE event divergence in the reservations service.
## Problem Patterns
1. Publisher fired event but subscriber didn't receive it
2. Reservation state machine stuck in transition
3. SSE connection drops unexpectedly
## Debug Workflow
### Step 1: Check SSE Broadcaster State
```bash
# Inspect active SSE connections
curl -s http://localhost:3004/api/v1/events/stream?venueId=<id> -H "Authorization: Bearer $TOKEN" &
# In another terminal, check broadcaster internals
node -e "const { getBroadcaster } = require('./dist/services/sse.js'); console.log(getBroadcaster().getStats());"
```
### Step 2: Verify Event Was Published
```bash
# Check reservation event log in DB
node -e "const { prisma } = require('./dist/services/database.js'); prisma.reservationEvent.findMany({ orderBy: { createdAt: 'desc' }, take: 10 }).then(console.log);"
```
### Step 3: Inspect Reservation State Machine
```typescript
// Check current reservation status
const res = await prisma.reservation.findUnique({
where: { id: reservationId },
select: { status: true, updatedAt: true },
});
console.log("State:", res.status, "Updated:", res.updatedAt);
```
## State Machine Transitions
```
PENDING → CONFIRMED (seat guest)
CONFIRMED → COMPLETED (dining finished)
CONFIRMED → CANCELLED (cancelled)
CONFIRMED → NO_SHOW (guest didn't arrive)
```
## Common Fixes
- **Missing subscriber**: Verify `Last-Event-ID` header for resumption
- **Stale connection**: Check exponential backoff (1s, 2s, 4s, ... 30s max)
- **Event dedup**: Verify event ID is unique and monotonic
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!