Skip to content
Back to skills

Sse Event Debug

ASecurity

How to triage SSE event divergence in the reservations service.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 22, 2026
developmenttypescriptbashnodeapidatabase

Works with

  • terminal
  • api

Security analysis

A96/100
  • mediumUses curl or wget to download content

Pro shows the line behind each finding and how to fix it

Scanned September 22, 2026

npx -y skills add mattbutlerengineering/mattbutlerengineering --skill sse-event-debug --agent claude-code

Installs 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 with every re-scan.

Security grade badge for Sse Event Debug
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattbutlerengineering-sse-event-debug/badge)](https://www.skillsdirectory.com/skills/mattbutlerengineering-sse-event-debug)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.