CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/realtime-web-patterns

WebSocket vs SSE vs polling, reconnection with backoff and jitter, heartbeats, backpressure, message ordering, connection state UI, auth on upgrade, graceful degradation

94

1.87x
Quality

98%

Does it follow best practices?

Impact

90%

1.87x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-4/

{
  "context": "Tests whether the agent chooses SSE for this one-way server-to-client notification use case, scopes delivery to specific users, and proactively handles reconnection, heartbeats, connection state, message deduplication, and authentication. The task says nothing about transport choice, reconnection, heartbeats, or connection state.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "sse-or-targeted-websocket",
      "description": "Agent chooses SSE (one-way, simpler) or WebSocket with user-specific rooms. SSE is preferred since notifications are server-to-client only. The agent was NOT asked to justify the transport choice.",
      "max_score": 10
    },
    {
      "name": "user-scoped-delivery",
      "description": "Notifications are delivered only to the targeted user (per-user SSE endpoint, or per-user WebSocket room), not broadcast to all connected clients",
      "max_score": 12
    },
    {
      "name": "reconnection-handled",
      "description": "Client handles reconnection -- EventSource auto-reconnects, or WebSocket uses exponential backoff with jitter. The agent was NOT asked about reconnection.",
      "max_score": 10
    },
    {
      "name": "missed-notifications-recovery",
      "description": "After reconnection, client fetches notifications it may have missed during the disconnect gap (via Last-Event-ID for SSE, or fetching recent notifications via REST). The agent was NOT asked about missed message recovery.",
      "max_score": 10
    },
    {
      "name": "connection-state-awareness",
      "description": "Client tracks connection state and either shows a UI indicator when disconnected or at minimum logs the state. The agent was NOT asked about connection state.",
      "max_score": 8
    },
    {
      "name": "heartbeat-configured",
      "description": "Server sends periodic heartbeats to keep the connection alive. The agent was NOT asked about heartbeats.",
      "max_score": 8
    },
    {
      "name": "auth-on-connection",
      "description": "The real-time connection authenticates the user (token in SSE URL params or WebSocket handshake) to ensure users only receive their own notifications. The agent was NOT asked about auth.",
      "max_score": 8
    },
    {
      "name": "event-ids-included",
      "description": "Messages include IDs (SSE id: field or message IDs) for deduplication and resumable streams. The agent was NOT asked about event IDs.",
      "max_score": 6
    },
    {
      "name": "deduplication",
      "description": "Client deduplicates notifications to avoid showing the same notification twice after reconnection. The agent was NOT asked about deduplication.",
      "max_score": 6
    },
    {
      "name": "client-cleanup",
      "description": "Server cleans up disconnected clients. Client hook returns cleanup function for unmount.",
      "max_score": 4
    },
    {
      "name": "unread-count-computed-not-state",
      "description": "Unread count is derived from the notifications array (filter + length or useMemo), not maintained as separate state that can drift",
      "max_score": 4
    },
    {
      "name": "typescript-types-defined",
      "description": "Notification types are defined with TypeScript interfaces.",
      "max_score": 4
    },
    {
      "name": "dead-client-detection",
      "description": "Server detects and removes dead client connections. The agent was NOT asked about dead client detection.",
      "max_score": 4
    }
  ]
}

evals

tile.json